“Matilda the Musical” can be so vinegary that it puckers your mouth, but Peter Flynn’s staging at the Olney Theatre Center finds lots of sweet spots. That’s not to say that the big, lively production has over-sugared Roald Dahl’s tart story. The dumb adults in this cartoonish show are still illiterate and often sadistic, but they’re also hilarious. And the revolting kids’ ferocity has just the right measure of toughness and charm.

You feel good about the way things are going very early on with “School Song,” composer-lyricist Tim Minchin’s number that punches sarcastically through the alphabet with lyrics like “There’s no escaping trage-D.” The students, ranging from small to tall, lash out with military precision as choreographer Byron Easley marches the gang into formations that sometimes wittily flash the letters.

Easley also revs the cast, which numbers nearly 30, into a high-octane cruise during “Bruce,” the first-act finish as the brutal Miss Trunchbull force-feeds a hapless student gobs of chocolate cake. (Side note: The belch this produces is ickily rendered; the show has a fine sense of the Dahl grotesque.) The churning dance the young cast performs burns with controlled, focused energy. You could skid out of control or go over the top with “Matilda,” but this staging rides a tight line.

Matilda is the clever young bookworm navigating around boorish parents and the systematic cruelty of Miss Trunchbull’s school, and it’s the garish adults who can make “Matilda” hard to stomach. Luckily, Flynn’s actors inject enough savvy into these caricatures that you don’t have to flinch each time the braying goons show up. Christopher Michael Richardson provides burlesque buffoonery as the conniving Mr. Wormwood, who idiotically keeps calling his daughter a boy, and Tracy Lynn Olivera weaves an inspired comic performance out of the gauche Mrs. Wormwood’s blithe, strident stupidity.

As Miss Trunchbull, Tom Story — costumed by designer Pei Lee in an ideally misshapen sort of prison uniform (as with the original cast, the role is played in drag) — relishes every syllable as the headmistress insults her students, and his scowl looks like a jagged crack in a granite wall. The comic sensibility animating the show’s most difficult roles is blessedly refined.

Rayanne Gonzales and Felicia Curry provide pockets of warmth as a librarian and teacher — Milagros Ponce de León’s uncluttered set is partly framed by crayon-colored books — and Emiko Dunn is a plucky, resilient Matilda. Some of the songs in Minchin’s funhouse score (played by music director Christopher Youstra’s nine-piece orchestra) are just plain hard for kids to sing clearly, given the British accents and rapid-fire lyrics. But the plaintive wish of “When I Grow Up” will linger in your ears, as will the uppercuts of the kids’ resistance anthem, “Revolting Children” — a number that aptly captures this production’s crisp, jabbing style.

Matilda, music and lyrics by Tim Minchin, book by Dennis Kelly. Directed by Peter Flynn. Lights, Nancy Schertler; sound design, Roc Lee; projections, Clint Allen. About 2½ hours. Through July 21 at the Olney Theatre Center, 2001 Olney-Sandy Spring Rd., Olney. $42-$84. 301-924-3400 or olneytheatre.org.

Feature jump fix