After Bart gets bullied at the school dance, Marge convinces the town to pass anti-bullying legislation. Homer then gets arrested and sent to rehab for bullying Ned Flanders, only to subsequently leave rehab as a hero.
Bart isn't excited about going to his first school dance, but after he accidentally destroys the orange drink dispenser Mrs. Muntz's fiancée brought over, a fifth grade girl is impressed and asks him to dance.
Bart then wins the "Best Dancer" trophy and the girl asks him to meet her outside, but the bullies are waiting for him and they break his trophy and humiliate him, leading the girl to tell him "a life lesson" and leaves him for good.
When Bart tells Marge about the incident, she goes to a City Council meeting and says that it is time to make bullies feel scared instead of their victims, and a bill giving the police wide powers to crack down on bullying is passed unanimously. Prior to the bill being passed, Hans Moleman initially voted "No" until Mayor Quimby angrily threatens and hits him causing him to change his vote to "Yes".
Chief Wiggum starts out by legitimately arresting bullies like Jimbo, Kearney, and Dolph after they attempt to steal the sleds Bart and Milhouse own. Chief Wiggum begins busting everyone who is falsey accused of bullying (including fellow officer Lou for not letting him steal his lunch). Homer, who has abused the new law, gets a taste of his own medicine when Rod and Todd Flanders (who are fed up with how Homer treats Ned) have him arrested and he gets sentenced to 30 days of treatment.
While in the center, Homer has an epiphany that he is cruel to Ned because his neighbor is better at Homer in everything he does, and Homer is then held up as a paragon of reform and celebrated. However, Ned doesn't accept this ridiculous logic and bluntly tells Homer that Ned does not forgive him for his past actions. A distraught Homer begs for forgiveness which Ned refuses several times. When Homer penitently kneels on Ned's lawn for a long stretch, Ned tells him he is forgiven. The Simpsons and Flanderses then join together and have brunch.