How? They say that males are usually taller, but that's not all that reliable.
Relying on that you would end up pulling up some female plants.
They also say that female plants have shorter internodes, but again that's not all that reliable either.
I don't think there's anyway to tell until you see that first pistil.
Even going by the shape of the calyx before the pistil comes out, ie. female plants have a triangular calyx, is not 100% accurate, I have been wrong occasionally relying on that.
I don't do anything until I see that first pistil or round pollen ball, even if I think I'm 100% sure.