A low-fat pudding, Grandma Plopwell's, is the sponsor of a Springfield contest that promises a luxurious trip to the most disgusting and dimwitted contest participant in town. Many Springfield residents enter the contest, but things do not go well when one of the judges, Rainier Wolfcastle, declares himself the winner for "being seen with you freaks". The contest ends in a riot and Lisa ends up hit in the face twice with pudding. She denounces Springfield for its anti-intellectualism in an open letter that ends up in the newspaper, for which no one reads. This impresses the Springfield Mensa chapter, which accepts her for membership after Principal Skinner shared her placement tests and she brought them a pie for their latest meeting.
Lisa joins Mensa alongside Comic Book Guy, Dr. Hibbert, Principal Skinner, Professor Frink, and Lindsay Naegle. After the pleasantries, Lisa finds herself at home alongside the Mensa members, whose sense of humor is so esoteric that it is said to be enjoyed by the "Dennis Miller ratio" of Americans. After being bullied out of their reserved gazebo at a park by drunks and Chief Wiggum, they fear that Springfield's quality is poor because of the city's stupidest residents having power over their civic institutions. The Mensa group goes to confront Mayor Quimby about the gazebo incident, until he escapes from the city when he mistakenly thinks the group has evidence about his corruption. The town's constitution states that in the absence of the mayor, the town is to be governed by the smartest by geniocracy. Now in control of Springfield, the group hopes that things will become much better.
Once in control, however, the group allows power to go to their heads. At first they efficiently implement their ideas for Springfield, which include banning green traffic lights and playing only classical music at the dog races, which elevates Springfield past East St. Louis on the list of America's 300 Most Livable Cities. However, they begin to internally fight over other ideas such as having theaters for shadow puppets and a broccoli juice program, and their wildly unpopular plans at a public meeting (including the banning of all contact sports and Comic Book Guy's plan to limit breeding to every 7 years) further expose the rifts inside the group.
The Springfield townspeople, angered by the new laws, surround the intellectuals in an angry mob and bring an end to Mensa's rule. Stephen Hawking has shown up to see what the Mensa group is up to and makes it clear he is unimpressed; however, he saves Lisa from being seriously injured by the angry townspeople. In the end, Hawking and Homer meet at Moe's Tavern for a drink. Homer imitates Hawking in an attempt to make him pay the tab and gets punched by a boxing glove on a spring, which is concealed in Hawking's wheelchair.
In the episode's other storyline, Homer steals a gift certificate during the post-contest and has erotic photos taken of himself as a gift to Marge, who gets distracted by the interior design Homer did in their basement.