WASHINGTON—The Trump administration on Friday urged the Supreme Court to rule that a longstanding federal civil-rights law prohibiting sex discrimination doesn’t protect gay people in the workplace.

“The ordinary meaning of ‘sex’ is biologically male or female; it does not include sexual orientation,” the Justice Department wrote in a high court brief submitted by U.S. Solicitor General Noel Francisco.

The legal filing came in a highly anticipated case the Supreme Court is scheduled to hear in October, the justices’ first major exploration of LGBT rights since it legalized same-sex marriage in 2015.

At issue is the meaning of Title VII of the 1964 Civil Rights Act, which broadly prohibits employers from discriminating against workers, including in hiring and firing decisions, based on an employee’s sex.

Lower courts have issued conflicting decisions on whether that provision should be interpreted to cover sexual-orientation job discrimination, prompting the Supreme Court to agree to resolve the disagreement.