The story starts with Leon Tolchinsky, an ambitious young schoolteacher, arriving in the village of Kulyenchikov. Upon arrival, Leon encounters a rather 'unintelligent' shepherd by the name of "Something Something Snetsky, the sheep loser." After a confusing and tedious conversation with Snetsky, Leon goes off to find the home of his new employer, Doctor Zubritsky.
Leon meets with Doctor Zubritsky and his wife, Lenya, after struggling with the locals (Mishkin the postman, Slovitch the butcher, and Yenchna the vendor). He is introduced to the Zubritsky's daughter, Sophia, and is immediately lovestruck. Alas, she proves to be just as unintelligent as the rest of them, if not more so.
He discovers that the town's idiocy is no accident, that it is a 200-year curse of stupidity cast on them by Vladimir Yousekevitch after his son killed himself because the first Sophia Zubritsky (not the doctor's daughter, but rather an ancestor with the same name) was forbidden to see Vladimir's son by her father, who found out the boy was illiterate, and made to marry another man. If Leon can't educate her within 24 hours of his arrival in Kulyenchikov, he, too, will fall victim to the curse. And the curse can only be broken if he can educate Sophia . . . or if she marries a Yousekevitch.
As well as idiocy, the people of Kulyenchikov are also incapable of loving. Still, even without love, the last of the Yousekevitch line, Count Gregor, proposes to Sophia twice a day. With more motivation than ever, Leon strives to educate Sophia. Try as he might, 9 o'clock rolls around, as announced by the magistrate, and all seems to be lost.
But Leon, being the smart young man that he is, fools everyone into believing the curse has befallen him. Count Gregor adopts him as a son, and Leon and Sophia are set to be wed. At the last minute, Count Gregor admits that the adoption papers are actually divorce papers and the wedding is nearly called off until he 'kindly' offers to marry Sophia.
With yet another trick up his sleeve, Leon asks the postman for his urgent letter and announces that his uncle has died and left all his debts to him. He says that that changing their surname couldn't help them escape the debt, and when asked what the surname was, he says "Yousekevitch." Leon and Sophia are wed, and the curse of Kulyenchikov is broken. (The letter really contained a bill from his college, saying that Leon needed to finish paying his debts.)
After the wedding, we see what has befallen all the characters. The Magistrate became a great judge, but fell into corruption and eventually was convicted for fraud. Mishkin wrote a six-hundred page novel on the Curse of Kulyenchikov, only to have it lost in the mail. Slovitch confirmed his greatest fears of being hopelessly stupid, when he bought four butcher shops in a town that only need one and went bankrupt within a month. Snetsky found his sheep, and eventually in time became a great philanthropist. Yencha went into real estate and now owns seventeen houses in Kulyenchikov, including Count Gregor's mansion. Lenya Zubritsky went into politics (becoming the first female mayor of Kulyenchikov) and now even her husband has to make appointments to see her. Doctor Zubritsky got accepted into a school of medicine and interior design became an esteemed doctor and now works for the Royal Family. Count Gregor renounced his bad ways and became the town monk. Occasionally he goes to the top of the hill to pray for God to throw water upon the village. Leon continues to teach, and Sophia happily bore their child and teaches Leon lessons of life.