Wikipedia’s entry on sex and gender distinction reads as follows:
“The distinction between sex and gender differentiates a person’s biological sex (the anatomy of an individual’s reproductive system, and secondary sex characteristics) from that person’s gender, which can refer to either social roles based on the sex of the person (gender role) or personal identification of one’s own gender based on an internal awareness (gender identity). In this model, the idea of a “biological gender” is an oxymoron: the biological aspects are not gender-related, and the gender-related aspects are not biological.”
Dragoman translators occasionally translates forms, passports, questionnaires and similar documents into English. Although the term sex is used to designate a person’s biological distinction, there is not a consensus on its use across different types of documents. For example, the new Turkish Identity Cards use the term gender to refer to the sex of the holder, passports use the term sex to make the same distinction.
Dragoman prefers using the term sex to designate a person’s biological distinction.
You can further explore this topic on writing well here.