The Greek filmmaker Yorgos Lanthimos is a deadpan dystopian comedian, an inventor of absurd, highly regulated societies that seem to exist in hidden pockets of everyday reality. In his 2010 film, “Dogtooth,” a middle-class couple raises three children according to an elaborate set of codes and rituals that include assigning new meanings to common words. In “Alps” (2012), members of a cultlike organization impersonate the recently deceased for the benefit of the bereaved. And now, in “The Lobster,” Mr. Lanthimos’s first English-language feature — and, perhaps, his masterpiece thus far — guests at a grand, old-fashioned hotel are given 45 days to find love or face being turned into animals.

That sounds like fairy-tale witchcraft, but there is nothing especially magical about “The Lobster.” (The title refers to the creature that the main character would choose to become.) It’s an aggressively literal-minded movie, set in a world where metaphors are all but banished and dreams and fantasies are drab and desperate affairs. The patrons of the hotel would be ridiculous if they were not so miserable, and vice versa. They are, in every sense, disenchanted.

David (Colin Farrell), who has a hangdog expression and an actual dog at his side, is sent to the hotel soon after his divorce. His arrival provides an opportunity for the audience to be initiated into some basic rules and axioms of the movie’s universe, although Mr. Lanthimos (who wrote the script with Efthymis Filippou) keeps a few surprises in store for later. In the city from which hotel residents are exiled, marriage (straight or gay) is not just a sacrament but also an obligation enforced by the police. Happiness appears to be a state of dead-eyed consumerist ease illuminated by an occasional wan flicker of mirth or dread.

At the hotel, the regimen of meals and activities is fairly straightforward. Behaviors are closely monitored, transgressions (notably masturbation) are punished, and desultory sexual relief is provided by the staff (notably a maid played by Ariane Labed). David soon befriends two other men (Ben Whishaw and John C. Reilly). They survey their prospects and applaud the formation of new couples.

The main form of organized recreation is hunting for the “loners” who live in the woods beyond the hotel grounds. A guest who shoots a loner with a tranquilizer dart is rewarded with an extension — an extra day to pursue courtship and postpone beasthood. Plausible couples need to have one salient trait in common, like poor eyesight, susceptibility to nosebleeds or a sociopathic disregard for the well-being of others. Whether such compatibility can be faked is a central dramatic question. David and Mr. Whishaw’s character both try, with varying degrees of success. Mr. Reilly’s has a harder time.

Out in the woods, the loners practice guerrilla warfare and declare their opposition to the sexual regulation and tyrannical monogamy represented by the hotel. Their leader (Léa Seydoux) tells new recruits that they can masturbate whenever they want. But as is so often true of revolutionary movements, this army of freedom fighters mirrors the dominant society in its capacity for brutality and coercion. Any kind of romantic or erotic attachment is forbidden, and disciplinary methods range from comical to horrific.

Cruelty and humor are nestled like spoons in a drawer. Mr. Lanthimos’s method is to elicit an appreciative chuckle followed by a gasp of shock, and to deliver violence and whimsy in the same even tone. “The Lobster” is often startlingly funny in the way it proposes its surreal conceits, and then upsettingly grim in the way it follows through on them. It’s not quite that suicide, mutilation and murder are treated as jokes, but more that the boundary between the serious and the silly has been almost entirely erased.

It falls to the actors to endow the director’s acute, misanthropic vision with emotional gravity and grace. Mr. Farrell, a habitual over-actor, is especially affecting because you can sense his effort to restrain himself. Rachel Weisz, as a loner who may be David’s soul mate, is perfectly cast as the only person in this world with the normal capacities for warmth, empathy and desire. She allows a credible love story to peek out through the elaborate trappings of allegory and satire.

Those are interesting too, though. “The Lobster” could be thought of as an examination of the state of human affections in the age of the dating app, a critique of the way relationships are now so often reduced to the superficial matching of interests and types. It is also, more deeply, a protest against the standardization of feeling, the widespread attempts — scientific, governmental, commercial and educational — to manage matters of the heart according to rational principles.