Despite his success as the creator of the animated series “Beavis and Butt-Head” and “King of the Hill,” Mike Judge has become something of a cautionary tale when it comes to directing live-action movies. His first one, “Office Space,” was a box-office flop that subsequently earned cult status. His next one, 2006’s “Idiocracy,” was so badly handled by 20th Century Fox that the only plausible explanation was that the studio wanted it to fail. (I’m not exaggerating. That really is the only plausible explanation, and there is ample evidence to support it.) So his latest effort, “Extract,” is met with a mixture of joy and trepidation — joy because his fans suspect it will be hilarious, like the last two were; trepidation because we’re wondering how it will get screwed up.

“Extract” deserves to be at least a modest hit, a perfectly good comedy with a lot of laughs and several fine characters. Like most of Judge’s work, it keeps a gentle pace, avoiding anything too madcap or abrasive.

It’s about a hapless man named Joel, played by expert hapless man Jason Bateman, who owns a company that makes flavored extracts for baking. He is well liked by his employees, sort of ignored by his wife, Suzie (Kristen Wiig), who has become cold and sexless in recent years.

After an accident on the factory floor, Joel worries that the injured employee, Step (Clifton Collins Jr.), might file a lawsuit. Egging Step toward this decision is a con artist named Cindy (Mila Kunis), who learns of the accident and befriends Step in the hopes of getting a piece of the action. She also takes a temp job at the factory, the better to stalk her prey, and flirts shamelessly with Joel — who is flattered and starts to wonder about the possibility of being unfaithful to his wife.

And if all that doesn’t sound hilarious, I don’t know what does!

Judge sticks close to the formula of “Office Space,” with an ordinary fellow surrounded by nutjobs, many of whom give him advice he would be better off not taking. His bartender friend, Dean (a wonderfully dippy Ben Affleck), recommends a steady diet of various recreational drugs, and it is while in just such a stupor that he and Joel come up with the brilliant idea of hiring a gigolo to seduce Suzie, thus making it morally permissible for Joel to cheat on her, too. The himbo hired for the job is a dumb “pool cleaner” named Brad (Dustin Milligan, showing good comedic range after TV’s “90210”), and I suspect you will not guess how that whole episode turns out.

Elsewhere, there’s David Koechner as an overly friendly neighbor in Joel and Suzie’s subdivision; J.K. Simmons as Joel’s plant manager, who refuses to learn the employees’ names; Beth Grant as a veteran assembly-line worker who blames everything on whoever doesn’t speak English; and Gene Simmons (yes, from KISS) as a sleazy ambulance-chasing lawyer. These figures, and several others with smaller roles (I did not mention the belligerent marijuana enthusiast), give the film a lively, raucous feel, even when, later in the story, things start to be a little more introspective and a little less funny.

Judge has said the story for this film predates “Idiocracy,” so it’s surprising that it has several half-baked elements. It’s not explained, for example, how Simmons’ character knows Cindy the con artist is dating Step, a fact that proves to be critical. Joel and Suzie’s marital woes aren’t resolved, which seems unfair considering how much weight that issue is given early in the film. And the very funny and capable Mila Kunis is wasted as Cindy, without a real story of her own.

But then there’s that circle of funny supporting characters surrounding Jason Bateman, whom I believe it is impossible not to love, or at least like a lot. “Extract” probably will not enjoy the cult classic status of “Office Space” and “Idiocracy,” but Bateman’s winning personality and impeccable comic timing are always worth watching.

B (1 hr., 31 min.; R, some harsh profanity, a fair amount of vulgarity.)