Place the caterpillar on a flat surface and observe it from above. Some species have transparent skin, and males will be developing two yellow organs straddling the heart line, closer to the rear than the front of the caterpillar's body. However, absence of these organs doesn't definitely mean that you have a female; they may not yet have developed enough to be seen.
Submerge the caterpillar in alcohol until it's dead.
Remove the horn on the caterpillar's tail with the scalpel; then make an incision lengthwise up the body to the head.
Open the slit gently and hold the skin back from the incision with dissecting pins.
Take the stomach and intestines out with a pair of tweezers. In a caterpillar, these will look like a brown pencil eraser.
Look for male sexual organs in the remaining cavity. Males will have a pair of testes (orange or yellow) about one-third of the distance from the tail to the head. You may need a magnifying glass, depending on the species, to find them.