Set in July 1912, a traveling salesman, "Professor" Harold Hill, arrives in River City, Iowa, intrigued by the challenge of swindling the famously stubborn natives of Iowa. Masquerading as a traveling band instructor, Professor Hill plans to con the citizens of River City into paying him to create a boy's marching band, including instruments, uniforms, and music instruction. Once he has collected the money and the instruments and uniforms have arrived, he will hop the next train out of town leaving them without their money or a band.
With help from his associate Marcellus, Professor Hill incites mass concern among the parents of River City that their young boys are being seduced into a world of sin and vice by the new pool table in town. He convinces them that a boy's marching band is the only way to keep the boys of the town pure and out of trouble, and begins collecting their money. Hill anticipates that Marian, the town's librarian and piano instructor, will attempt to discredit him, so he sets out to seduce her into silence. Also in opposition to Hill is the town's Mayor Shinn, who orders the school board to obtain Hill's credentials. When they attempt to do so, Hill avoids their questions by teaching them to sing as a barbershop quartet via "sustained talking." They are thereafter easily tricked by Hill into breaking into song whenever they ask for his credentials.
Meanwhile, Hill attempts to win the heart of Marian the librarian, who has an extreme distrust of men. His charms have little effect upon Marian until he wins the admiration of both her mother and her withdrawn and unhappy younger brother Winthrop. Marian falls in love with Hill, and subsequently hides evidence she has proving he is a fraud. The band's instruments arrive and Hill tells the boys to learn to play via the "Think System," in which they simply have to think of a tune over and over and will know how to play it without ever touching their instruments. Hill's con is nearly complete and he is about to leave town when a disgruntled competing salesman comes to town and exposes Hill and his plans. Chased by an angry mob and pressed to leave town by Marcellus and Marian, Hill realizes that he is actually in love with Marian too and can't leave River City. He is captured by the mob and brought before a town meeting to be tarred and feathered. Hill is saved by the boy's band who miraculously have learned to play their own instruments. Hill remains in River City with Marian to conduct the boy's band full time.