If you missed out on traveling this summer to that Airbnb with the swimming pool and the wide-plank floors, the gray marble kitchen island and the invitation to “step into our beautiful house and leave the world behind,” Rumaan Alam’s third novel makes for a wonderful escape — at first. The family at the heart of “Leave the World Behind” has left its cramped Brooklyn apartment for a week of relaxation in a remote corner of Long Island to celebrate a promotion for the mother, Amanda, at her advertising firm. The father, Clay, a professor of media studies at City College, is wrapping up a book review but otherwise ready to make the most of the last days before fall semester. And their kids, Archie and Rose, have the usual concerns of 15- and 13-year-olds: video games, social media, their changing bodies. They’re thrilled about the swimming pool, not so much about the lack of cell service.

The initial days unfold at a vacation’s leisurely pace, without much happening but with plenty of wit and trenchant observation. Alam’s work is Cheever-like in the examination of New York privilege, the assured vitality of the prose and, we’ll come to find, the dark, surreal vision: “The house had that hush expensive houses do. Silence meant the house was plumb, solid, its organs working in happy harmony. The respiration of the central air-conditioning, the vigilance of the expensive fridge, the reliable intelligence of all those digital displays marking the time in almost-synchronicity. At a preprogrammed hour, the exterior lights would turn on. A house that barely needed people.”

Suddenly into that orderly silence a loud noise erupts, the first of several that will puncture this holiday and throw everyone’s lives off-kilter. It’s a knock on the door late at night. On the other side: a Black couple. Older. Well-heeled. They say they’re the owners of this house. They were at the symphony in the Bronx, they say, but a blackout has swept across much of the East Coast. Afraid of the chaos they might find in the city, not wanting to climb 14 floors in darkness to their apartment on the Upper East Side, they’ve come, unannounced, apologetically, to their second home, where at least for the time being the power is still on. They want to stay here, in the in-law suite in the basement, until the trouble has passed.

This premise alone could make an entire book, as it does films and plays like “Guess Who’s Coming to Dinner” and “Six Degrees of Separation,” which take on race and the appearance of Black strangers at the doors of White families. And for many chapters Alam explores every facet of this situation, exposing the fear and distrust and outright racism of Clay and Amanda, who feel that this is their house, their site of leisure. And the more they assert themselves, the more the house becomes a metaphor for the country, a battleground over right of ownership. When Amanda thinks, “those people didn’t look like the sort to own such a beautiful house,” she reveals a glimpse of white supremacy beneath the neoliberal mask of racial tolerance.

The owner’s wife, Ruth, worked for years at the most exclusive private school in the city. The owner has made his money in private equity. He goes by the initials G.H., but his name by birth is George Washington. Father of the country. Landowner. Enslaver. The clever ironies and turns on the property metaphor are matched only by the twists in the plot to come. A book that begins as a novel of class and then comes to encompass race by the middle transforms again into a waking nightmare. People wander off. Strange animals appear in the yard. Terrifying noises resound. The streets empty of visible life. An eerie silence falls over the land. And the narrator, who has moved deftly from character to character, investing us fully in the lives of all six occupants of the Airbnb, expands our viewpoint outward, to the woods, to the city, to the planet. And the news is not good.

“Leave the World Behind” is the perfect title for a book that opens with the promise of utopia and travels as far from that dream as our worst fears might take us. It is the rarest of books: a genuine thriller, a brilliant distillation of our anxious age, and a work of high literary merit that deserves a place among the classics of dystopian literature.

Porter Shreve is the author of four novels. He directs the creative writing program at the University of Wisconsin at Madison.

Leave the World Behind

By Rumaan Alam

Ecco. 256 pp. $27.99