The similarity of the pictures being spewed out by the Judd Apatow factory like so many cinematic sausages to those of the now-inactive John Hughes has never been more evident than in this high school comedy from writers Kristofor Brown and Seth Rogen. On the one hand, to be sure, it’s like a prequel to “Superbad” (which Rogen also co-wrote)—its three freshmen, Wade (Nate Hartley), Ryan (Troy Gentile) and Emmit (David Dorfman), could be taken as younger (and happily, much less foul-mouthed) versions of seniors Evan, Seth and Fogell. But on the other, in the boys’ story it has much of the same spirit that marked a movie like “Sixteen Candles.” One can see more than a hint of Anthony Michael Hall’s Farmer Ted, for instance, in Dorfman’s diminutive, hyperactive Emmit. (Even the braces fit.)

But “Drillbit Taylor” differs from “Sixteen Candles” in grafting a typical Owen Wilson vehicle onto the teen story. And that, frankly, is where it goes wrong. Wilson plays the title character, a scruffy homeless guy (and, in his telling, former Army Ranger) who agrees to serve as the boys’ bodyguard when they’re brutalized by campus bully Filkins (Alex Frost) and his lackey Ronnie (Josh Peck). He’s a phony, of course, and intends to fleece the kids for the cost of a plane ticket to Canada as well as rob their houses, but inevitably he bonds with them and genuinely wants to help them, however incapable of doing so he may be. And when he begins impersonating a substitute teacher at their school, he grows to like the part, especially after he strikes up an unlikely romance with a pretty English instructor (Leslie Mann).

As long as the movie sticks to Wade, Ryan and Emmit, it’s actually rather charming in a throwback Hughesian way. Hartley, Gentile and Dorfman play well off one another, and their childish naivete is a refreshing change from the incessant “Porky’s”-like raunchiness that infects virtually all high school characters in movies nowadays (“Superbad” being a prime example). In that connection Wade’s sweet crush on a classmate is a far cry from the hormone-driven lust that one usually encounters in these kinds of pictures. (Only Ryan’s rap face-off with Filkins drags us into less attractive territory.)

But the screenplay goes off the rails in two respects. One is the misguided treatment of Filkins. The kid is portrayed as a genuine psycho, not funny at all, unlike in the Hughes pictures, where the villain either was a slapstick goofball or was simply misunderstood and turned out not to be such a bad fellow after all. Here the guy’s just a nasty thug, and naturally the school principal (played without much zest by Stephen Root) is totally clueless about him.

But that’s a minor point compared to the whole Drillbit side of things. As the dopey would-be bodyguard, Wilson is just doing his familiar slacker shtick, and though for a while it has a certain lazy charm, we’ve seen it too often for it to work very long—it’s almost like sitting through “You, Me and Dupree” a second time (no, thank you). The presence of Don McBride as a cynical street guy who encourages Taylor in his misdeeds doesn’t help any. And matters go completely awry in the final reel when the two clumsy plot threads come together as Drillbit has the obligatory change of heart and confronts Filkins on the boys’ behalf. The result is a scene that could have come straight out of last week’s “Never Back Down.” And it was arguably funnier there.

Under the direction of Steven Brill, “Drillbit Taylor” moves along reasonably well—better than most of his previous pictures, in fact—though it slows to a walk when the shambling Wilson takes over. And from the technical side it’s solid enough, as Apatow products ordinarily are.

So long as the freshmen are at center stage, this is cheerily engaging in an old-fashioned way. But when the upperclassmen and adults take over, it pretty much flunks out.