Fans of Stephen King’s novel “The Outsider” will immediately notice that liberties have been taken with the story when HBO’s limited series based on the 2018 book debuts Sunday night.

That’s because screenwriter Richard Price (“The Night Of”), ran out of plot.

“I followed the events of the book but the issue was 10 hours [of TV time],” Price tells The Post. “By the third hour, I was halfway through the book. I had seven hours to go.”

Before you freak out, Price — who is also the author of nine novels, including 2008’s “Lush Life” — reminds viewers that “a book is not a movie. There’s the introduction of characters and situations that did not exist in the book. I had to fill it with minor events. There’s so much in a book but there’s no thinking in a screenplay. You see and you hear. I had to visualize and physicalize a lot. If you take out all the narrative observations, a novel gets reduced greatly.”

“The Outsider” stars Ben Mendelsohn (“Bloodline”) as Ralph Anderson, a Chicago-based detective tasked with investigating the grisly murder of an 11-year-old boy. Anderson’s arrest of prime suspect Terry Maitland (Jason Bateman), a popular baseball coach at the local school with a great alibi, seems to wrap up the case neatly — too neatly, it turns out.

A horrifying turn of events results in Anderson being putting on administrative leave and a community feeling torn apart. Yet the sidelined detective can’t let the case go, and he is eventually paired with unorthodox private investigator Holly Gibney (Cynthia Erivo), who carries religious statuettes with her and has knowledge of a similar crime that took place in Pennsylvania.

The casting of Gibney represents another departure from the King novel. In the book, the character is white (and is played by Caucasian actress Justine Lupe on the series “Mr. Mercedes”). In “The Outsider,” the character is African American.

“HBO wanted Cynthia,” Price explains.

During the investigation, Gibney meets with another investigator, Andy Katcavage (Derek Cecil, “House of Cards”). “I had the characters comparing notes about growing up in a coal town in a Lithuanian community,” Price says. “Cynthia has a couple of Lithuanian phrases about how a West Indian girl might wind up in a coal patch in Pennsylvania.”

“The Outsider” weaves supernatural elements into the story and presented a challenge for Price to go beyond the familiar urban crime beat seen in works like “Clockers.” Not surprisingly, he embraced it. “I’ve always wanted to write a scary story since I was a kid,” he says. “I was very happy with this project because it had both elements. There was a chance to do my spooky thing.”

Although Price wrote all 10 hours of “The Outsider,” he had not seen any of the episodes before flying from New York to LA for Wednesday’s red-carpet premiere. He says HBO kept him on a tight leash. “I had to write so many episodes so fast and I didn’t want to get sidetracked,” he says. “I didn’t want anything to take away from what I had to do on the page. Each episode was an 11-day shoot. It was like being chased by a plane.”

Fans of “The Night Of” may notice a lack of sarcasm among the dour characters of “The Outsider.” Price counters that’s because “Harvey Keitel isn’t in it.” (He wasn’t in “The Night Of” either, but you get the idea.) His next project includes two novels that he has signed to write. One is a followup to “The Whites,” a 2015 mystery he wrote under the pen name Harry Brandt. The other is based in Harlem, where he lives with his wife, novelist Lorraine Adams.

“I was going to do a panoramic thing like ‘Lush Life,’ but I don’t want to do panorama anymore,” he says. “I’m too lazy.”