The Simpsons and many other prominent Springfieldians go to see a performance of Stab-a-Lot: The Itchy & Scratchy Musical. The audience greets the performance with a standing ovation. Julianna, the show's director, and a former student of Springfield Elementary School, greets the reception along with Principal Skinner. Principal Skinner acknowledges Julianna's straight A's at the school, but attributes her "B or two" in Math to being a girl. The audience is outraged by Skinner's remark. Skinner's attempts to defend himself make the situation worse and he is beaten by the Itchy and Scratchy puppeteers.
The next day, the teachers of Springfield Elementary and other ladies stage a protest outside the school against Skinner. To pacify them, Skinner holds a conference in the school's auditorium, inviting all protesting ladies to attend. Nothing he says or does (such as wearing a skirt and saying that men and women are equal but not identical) has a good effect on the ladies, so he has a new breakdown onstage. Chalmers introduces them to their new principal. Melanie Upfoot, who for her first act, segregates the school across gender lines.
At first, Lisa seems to feel right at home in the girl-friendly school. But she grows disillusioned with the school's condescending attitude and spies on the boy's side, where actual, challenging math is taught. Skinner, now an assistant to Groundskeeper Willie, chases Lisa away.
With the help of Marge, she disguises herself as a boy named Jake Boyman (nicknamed "Toilet" by the boys after toilet paper is stuck to the sole of the shoe) and attends the boys’ school. During the math class, she gives a wrong answer and is corrected by Martin, but she feels happy to have learned something. Unfortunately, being with the boys means having to act like one and, during lunch, Lisa inadvertently gets into a fight with Nelson. Despite her efforts to use her intelligence to escape her situation, she gets beaten up. When Bart returns home that day, he is happy to have seen a fight and runs upstairs to tell Lisa, only to discover that Lisa is the boy who got beat up. While he remains amused that his sister is actually "Toilet" he forcefully says "no one should be forced to be a girl" and that he'll help her blend into the boy's school.
Lisa begins to pick up the code of the boys, including eating French fries that fell onto a dirty restaurant floor and beating up a defenceless Ralph Wiggum; this last act wins over Nelson and the others and "Jake Boyman" becomes an accepted part of their world. Lisa does well in math class, and at an awards ceremony is recognised for her outstanding performance in the subject. She then reveals her true identity to the whole school, and she explains why she had to disguise herself. Bart gets up and tells everyone that she did well only because she was acting like a boy. After that the boys all engage in a chair fight. Lisa walks off stage to Martin playing the flute, but quietly sneaks up behind him and hits him with a chair.
A subplot of the episode involves Homer and Marge's relationship where, during the morning after the incident, Marge tries to cheer Lisa up by pointing out the contributions of the women to society. When Homer and Bart interfere with the conversation remarking that the men are more important than the women, Marge retaliates by forcing Homer to sleep on the couch. The next night, Homer tries to apologize for his sexism, but lacks both intellect and sensitivity to this and is once again forced to sleep on the couch. When Homer tries to get comfort from Santa's Little Helper, he unwittingly insults him by claiming that he is dumber than he himself. The offended dog then kicks Homer out of the house and forces him to sleep in his dog house, where Homer wonders what he did to deserve these punishments.