Ah, I read it as the flag went up for the player that it had gone over, not the one who handled it.If the action that caused the player to commit an offside offence was the handling, then if the flag was raised prior to that happening it was an incorrect flag. The AR should only flag when the offence is committed.
If it is a handball that commits the offside offence it's a DFK.
The only time a flag before would be acceptable is if there was an interfering with an opponent infraction.
We can assume it was an incorrect flag as the OP states the handling of the ball was the offside offence