When Cybill Shepherd dumped Mark Harmon in a recent "Moonlighting" episode, right-thinking women the world over were shocked and appalled. Happily, the former "St. Elsewhere" star and Coors beer booster is on the rebound as a genial gym teacher in a rambunctious comedy aimed at the Clearasil crowd.

Harmon as Freddy Shoop is Mr. Kotter, hanging 10, in Carl Reiner's California-set "Summer School," an ooh-so-gross, wonderfully silly kids' caper full of sophomoric sass, horror spoofery and the old standby -- vomit jokes.

Reiner's giving a lesson in how Southern Californians got that way with this screwball fable from the beach-ball jungle. Here sun block and chalk dust mingle, and kids with the brains of Styrofoam kick boards mangle pronouns.

Slow Minds at Ridgemont High.

But help arrives in the shape of Harmon, People magazine's 1986 "Sexiest Man Alive," who finds his deeper self at the head of this class of rowdy remedials -- sun-damaged dyslexics, class-cutters, sleepy male strippers and dumb ballplayers. Naturally, all of them are full of hidden potential that can only be tapped by simpatico schoolteachers like Kotter, Sir, or in this case, Freddy Shoop.

Harmon, with his heartbreaker's looks and surprisingly sure comic timing, is irresistible as Shoop, a goof-off on a par with his underachieving charges. A man who would look natural with a milk mustache, he's cannily cast as an overgrown educator who'd rather be at the beach with his dog Supermutt. Alas, his Hawaiian vacation dreams become so much poi when he is tagged to teach bonehead English or lose tenure.

The star student is Dean Cameron, making his frenetic feature debut as Francis (Chainsaw) Gremp, a slasher movie fan said to have the "IQ of a salad bar." With the help of his best buddy (Gary Riley), a veritable Siamese twin, Chainsaw stages the attack of the flesh-eating bunnies and the movie's memorable classroom massacre. (Blood and guts courtesy of latex Wunderkind Rick Baker, who created the "Star Wars" bar scene.)

The hard-working Cameron seems bound to turn up next as a sidekick in a John Hughes film, though his aspirations here are nowhere near so fanciful as those of Hughes' kids. "Summer School" is proud to be junk food, but it still tackles the serious subjects of illiteracy, teen-age pregnancy and young adult alcoholism. However, writer Jeff Franklin never preaches; he makes his points painlessly. "Fact: Alcohol kills brain cells," says Shoop to a tiddly Chainsaw. "You lose one more, you're a talking monkey."

Caught up in the task and motivated by a pretty history professor (Kirstie Alley), Shoop finds that he is maturing into a terrific teacher, putting self-interest aside and inspiring his kids to believe in themselves. Now the teens apply themselves to their textbooks, chew their pencils and behave like Harvard hopefuls taking their SATs. "Summer School" wisely resists a fairy tale ending when some can't make the grade. But the moral is a sweet one: If you try, you never fail. The world is graded on a curve.

Summer School, rated PG-13, is at area theaters and contains mild expletives.