At best it is very distracting, and at worst very depressing, and can lead to poor academic performance.
If your school is all male, then your heterosexual romantic/sexual social life is either non-existent, or with people outside of school. Neither of those cases leads to anywhere near as much social rivalry and drama as you have in a mixed gender school with a ratio far from 50/50. It's that rivalry and drama that gets in the way of academics.
They don't have quotas, but Caltech has gone to considerable effort to lower the male/female ratio to address the problems mentioned in my comment.
They were male only before 1970, and then started admitting undergraduate women. When I was a student there, in the late '70s and early '80s, around 15% of the undergraduates were women, and this imbalance was the #1 complaint by far among both the male and female students about campus life.
Caltech worked on improving this by actively recruiting female students. They didn't change admission standards or give any preferences to females when evaluating applications, but they tried hard to make sure than more females applied, and that those accepted didn't pick another school over Caltech.
For example, as a male with good enough grades and test scores to get into Caltech but only about average for an incoming Caltech student, Caltech was indifferent to whether or not I applied, or whether or not I accepted when they offered admission.
For a female with the same grades and test scores, they would have reached out and tried to convince her to apply, and there is a good chance they would even have sent someone in person to argue the case for Caltech to her and her parents.
These efforts paid off, with the male/female ratio steadily improving. They are now at about 55% male/45% female.