Sometimes a movie comes along that is so tone-deaf and utterly incompetent that viewers can only sit back in wonder at just how things could have gone so wrong. “Bad Teacher,” a new alleged comedy starring Cameron Diaz as an utterly contemptuous excuse for a human being who inexplicably lands a job as a high school teacher, is one of those films.

“Bad” tells the threadbare tale of Elizabeth Halsey (Diaz), who at the movie’s start is a foul-mouthed gold-digger who arrives home one day to find her wealthy fiance breaking up with her on the orders of his mother, who’s outraged that Elizabeth has burned through $16,000 of his money in a single month. Left without her financial lifeline, Elizabeth loudly wonders what she’s going to do to survive – and as the movie jumps four months into the future, we see that she has become a high school teacher who hates not only her fellow teachers but her students as well.

In fact, Elizabeth is so unwilling to do anything remotely educational that she merely orders her students to plug in the TV and DVD player each morning, and proceeds to show them movies about teachers, like “Stand and Deliver,” “Lean on Me,” and “Dangerous Minds.” While this idea is admittedly funny in split-second bursts as the students watch the films in slack-jawed befuddlement and wonder why they never seem to be given anything challenging to do, the running gag is also indicative of the lack of effort put in by “Bad” screenwriters Gene Kupnitsky and Lee Eisenberg; rather than putting in any effort into their script themselves, they’re content to kick back and allow viewers to elicit ironic chuckles at memories of much better films.

Elizabeth also smokes pot constantly, comes into work each morning with a hangover, and winds up caught in two battles for her attention. She sees rich new teacher Scott Delacorte (Timberlake) pull up in a fancy sports car wearing expensive duds and immediately throws herself at him, while deflecting the attentions of average-shlub gym teacher Russell Gettis (Jason Segel). Meanwhile, veteran teacher Amy Squirrel (Lucy Punch) is a pristine-living perfect teacher who immediately seeks to bring Elizabeth and her wild ways down – particularly once she realizes that Elizabeth is conducting a series of financial scams to finance getting a set of giant new breasts.

Maybe this plot doesn’t sound too bad on paper, or seems like it at least could be passably funny amid the current vogue for raunchy R-rated comedies. But I’m an easy target for that brand of film, and rank flicks like “The Hangover” and “There’s Something About Mary” as some of my all-time favorites – and this still didn’t work for me. At

all.

In order for a comedy to be funny, the characters have to be taking a humorous swipe at some form of recognizable human behavior, as well as turn aspects of normal, everyday life upside down. But in “Bad Teacher,” the only character that is remotely likable or recognizable as a human being is gym teacher Russell, and in portraying him, Segel is appealing but left with the almost utterly thankless role of commenting on Elizabeth’s bad behavior and hoping he can find a way to show her he can make up for being broke by being fun.

Everyone else is such a garish, overplayed freak that it starts to feel like the writers and actors are engaging in a second-grade home movie version of what they think is a naughty comedy. Diaz is so brazenly obnoxious that she only briefly becomes sympathetic near the end, when someone at the film’s studio must have realized that they had to come up with some sort of happy ending to trick the audience into leaving with a vague sense of satisfaction.

Timberlake, meanwhile, is stunningly off-key as Delacorte, who is inexplicably a virgin without it ever being clearly stated whether this good-looking wealthy guy in his 20s is hyper-religious or has any other reason for his status. A scene in which he has a chance to have sex with Elizabeth and merely proceeds to “dry hump” her in various positions is so flat-out illogical that it can’t even be funny: what guy would possibly keep his clothes on in that situation?

And what were an established movie star like Diaz and a musical superstar like Timberlake thinking when they allowed themselves to be directed in one of the most stupid and awkward scenes ever committed to celluloid? Yet the scene is emblematic of the movie as a whole, which feels like one long dry hump: you keep thinking this is about to be fun, but never actually is.

And I haven’t even gotten to the music by Michael Andrews, who should be so ashamed at his alleged attempt at a score that he should immediately seek to have his name taken off the film if he ever wants to work again. Virtually the entire film is underscored by a series of heavy-handed, thumping keyboard sounds that hammer home each and every second that director Jake Kasdan desperately hopes he can trick the audience into laughing.

You might have noticed that I’ve mentioned the filmmakers’ names more than I usually do in a review. That’s because I’m trying to perform a public service: to either make viewers learn the filmmakers’ names so that they can avoid their work in the future, or at minimum, shaming those involved in making this mess so that they try a lot harder if they ever get a chance again.

Someone needs to teach everyone involved how to make a watchable movie. At least I have hope for the rest of the year in cinema, because things can only go up from here.