The kids are more than alright – in fact, they’re an absolute joy in this ridiculously entertaining new show with music by Andrew Lloyd Webber, lyrics by Glenn Slater and book by Julian Fellowes. Adapted from the 2003 movie starring Jack Black, it focuses on Dewey Finn, a slacker wannabe rocker who is dumped by his band and winds up masquerading as a supply teacher at a snooty prep school where he proceeds to unleash the inner rock gods from his class of pre-teens as he prepares them in secret to compete in a Battle of the Bands. The show, directed by Laurence Connor, is a quirky hoot with a heart, a fable about the empowering force of music that crackles with mischief and sly irreverence – and it’s clear that the material strikes some deep chord within Lloyd Webber who has here composed his happiest and most confident score in a long while.

A couple of tripping numbers gently satirise the over-regimented, grade-fixated ethos of Horace Green Prep School. Of her charges, marching in lock-step, headmistress Rosalie (Florence Andrews) sings that “While they’re in our care, we tenderly prepare them to compete with the elite/Till they are dispersed to Harvard, or at worst, Cornell”. The place is as alien as Mars to Dewey who has stolen his flat-mate’s identity in order to earn some rent money. “My parents don’t pay $15,000 a year for recess,” objects the class smarty-pants, Summer (Eva Trodd), when the hung-over Dewey declares that he’s leaving them, more or less permanently, to their own devices. It’s only when he chances on a music class and hears the kids’ skilled musicianship as they accompany the headmistress trilling the Queen of the Night’s aria that he hatches his scheme to turn these classical geeks into a rebel rock band.

David Fynn is bliss as Dewey. In a performance of explosive energy and scapegrace charm, he shows you a shaggy free-loading slob who turns into a man possessed when promulgating the gospel of rock, replete with frenzied flourishes of guitar-shredding zeal. While it wouldn’t be true to say that there’s no end to Dewey’s talent, his passion for heavy metal is boundless and his initially reluctant pupils pick up on this and are enthused. Lloyd Webber is heard in a pre-recorded voice-over at the start assuring us that the kids are playing all their instruments live. Since they are aged between 9 and 13, the guitars are nearly as big as some of them are. It’s an undeniable point of superiority over the film that the stage show puts us in the same room as these preposterously talented performers whose infectious delight in their skills gets the joint jumping with joy. And the score contains two rollicking rock numbers that chart their transformation with particular wit and punch.

First there’s the elating “You’re In the Band”, in which Dewey, with interpolated riffs from Lou Reed, Deep Purple, and Beethoven, appraises the individual aptitudes of his students and moulds them to his needs. Buttoned-up pre-adolescents, who have never done anything before for which they could not be awarded a gold star, start to thaw as they are introduced to the immemorial arts of axe wielding, synth pumping, and moody-pout formation. Then there’s the glorious anthem “Stick It To The Man” that sums up Dewey’s anti-authoritarian philosophy of what rock is for – “Parents overwork ya/Stick it to the man!/Hate the way they jerk ya/Stick it to the man!” The kids are driven to pogoing, head-banging ecstasy.

The book by Julian Fellowes (operating at quite a schlep here from Downton Abbey and Gosford Park) cleaves pretty closely to Mike White’s droll screenplay (sticking in the odd new gag and contemporary reference to, say, the Kardashians). Both treatments are serenely indifferent to the narrative implausibility (arguably part of the fun) but shrewd and truthful about the relationships thus forged. Not all of Lloyd Webber’s attempts to expand the piece emotionally pay off. As in the film, the uptight headmistress turns out to be a closet Stevie Nicks fan and Florence Andrews sounds lovely in the pining power ballad “Where Did The Rock Go?”. But, in the circumstances, shouldn’t the song have more of a rock edge? On the other hand “If Only You Would Listen”, the students’ lament to their heedless yuppie parents, offers a very moving glimpse of a bleak hinterland and never cloys even when it is reprised with a grateful twist (“only you would listen”) in their bid to re-embolden their now disgraced teacher.