You can tell the difference by the levels of hormones in the blood, in males you normally find Testosterone, in females you find Oestrogen. There are exceptions where neither or both are found in the bloodstream, this normally indicates that the subject is an alien or a robot.