Well, you can do that by looking at the reproductive organs! In a female the epigyne is situated on the underside of the abdomen. In a male, there are two thickened pedipalps at the front of the head. They look like two "boxing gloves" and are usually clearly visible! So if you see two thickened and hardened structures on the head, then it is certainly a male. A female also has two pedipalps, but these are not used as a reproductive organ and are therefore not thickened.
P.S. The reproductive organs in spiders are a very important identification characteristics and in many cases often the only way to be able to say with certainty what species it is!
Females (left) and males (right). Top row: Nursery web spider (Pisaura mirabilis), male has only one pedipalp left and holds a nuptial gift in his jaws (©Leo Vaes en André Hermans). Middle: Spotted wolf spider (©Richard Louvigny en Danny Declercq). Lower row: Herb Hammock spider (©Pierre Oger en Bert Pijs).