There is no reliable way to tell the gender of young goldfish.
However, during the fishes breeding season, if you look to see if the fish has white pimple-like bumps on their heads and gill covers, then that fish is most probably a male. The bumps are called 'breeding tubercles' and they develop just before the breeding season. But after the season ends, these bumps gradually fade away (or are locked up until next season).
Another way to tell the sex of your goldfish is to have a look at the colour of their scales during breeding season. The males colour intesifies, to impress the female (dur!