So a screenwriter, a photographer, the district attorney of Clinton County, N.Y., and Ben Stiller drop by a small-town street corner together to see a manhole.

It sounds like the setup of a joke — and that was a problem. “I got that,” Stiller said recently. “ ‘Ben Stiller is going to come up and make a comedy about this and make fun of us.’ ”

His response to those assumptions that met his arrival two years ago in Dannemora, N.Y., arrives on Showtime on Nov. 18 in the form of a seven-part miniseries called “Escape at Dannemora.” The series is based on the real-life escape of two inmates from the maximum-security Clinton Correctional Facility in 2015 — they emerged from that same manhole — and the weekslong summer manhunt through the thick woods of upstate New York near the Canadian border. The series stars Benicio Del Toro and Paul Dano as the inmates and Patricia Arquette, almost unrecognizable after gaining 40 pounds and a brash upstate accent, as Joyce Mitchell, the prison employee who helped them get out.

All seven episodes were directed by Stiller, best known for his work in front of and behind the cameras in his own comedies, including the “Zoolander” films and “Tropic Thunder.” The tawdry elements of the prison break story, including Mitchell’s romantic entanglements with both inmates, would seem to lend themselves to a dark comedy.

Not to Stiller. On the contrary, he has delivered a gritty, intense drama that calls to mind the dark thrillers of the 1970s, a suspenseful addition to the prison genre that wears its deep research and attention to detail on its black-and-white-striped sleeve.

“I was curious how something like this really happens,” Stiller said in an interview in his office in Manhattan. “That sort of led to learning more about the prison dynamics and the whole ecosystem of the prison.”

Screenwriters Brett Johnson and Michael Tolkin were working together on the series “Ray Donovan” when the inmates were discovered missing on June 6, 2015. The writers found the sensational details riveting: The inmates, David Sweat and Richard Matt, both convicted murderers, painstakingly sawed through their cell walls and a thick, wide steam pipe beneath the hulking prison and emerged from the nearby manhole. The hacksaws and other tools they used came from Mitchell, who initially planned to kill her husband and flee to Mexico with the convicts, but instead had a change of heart and a panic attack.

The writers began working on a script even as the manhunt dragged on that summer. Then, on June 26, officers found Matt outside a trailer in the woods and shot him dead. Sweat was captured two days later. Mitchell and a corrections officer, Gene Palmer, played by David Morse, were arrested and charged with aiding their escape.

The two writers brought a draft of a screenplay to Stiller, who had been in Italy filming “Zoolander 2” during the manhunt. “I asked them how much of it was real,” he said. Fifty percent, they answered. Stiller passed. “I don’t want to make something up,” he said.

Then a year later, the state Inspector General’s Office released a 150-page report revealing the details of the events leading up to the escape and the lax oversight behind the prison walls that allowed the inmates to work on their plan for months unnoticed.

“It read like this novel,” Stiller said. The screenwriters found material and excerpts from interviews with those involved that were better than anything they could have made up. For example, Palmer, the officer, had recalled giving inmate Matt a package of ground beef in his cell, not knowing that Mitchell had hidden a blade inside. The gift itself was forbidden, but hardly uncommon in the quid-pro-quo relationship between jailer and jailed.

“I knew,” Palmer told investigators, “we were in a gray area with the meat.” That sentence became a sort of mantra behind the scenes of the show, Stiller said. Remember the gray area.

The director and writers studied transcripts from the interviews with Sweat and others. Stiller contacted Andrew J. Wylie, district attorney of Clinton County, and they set up the meeting at the manhole. A photographer who was there offered to show Stiller the trailer in the woods where Matt was flushed out by officers, and the patch of grass where he was fatally shot.

“That really drew me in,” Stiller said, “It was so eerie, the trailer and that nook in the woods.” He filmed in the same trailer and re-created Matt’s final seconds in exactly the same spot of grass, even using police officers who were present that day in 2015.

Stiller and the cast, after receiving the blessing of Gov. Andrew Cuomo, visited Clinton Correctional and saw the cells and the catwalk used in the escape, which seemed to impress the staff. “They saw we were trying to tell the whole story,” Stiller said. “They talked about when rules were broken.”

The actors said visiting the prison was, as Dano put it, “worth, like, 10 books.”

“The second you step in there, the chill in the air, the smell, the sounds, seeing the inmates lined up in this strict regimen, the size of their cells,” he said.

The screenwriters saw fresh material in a familiar genre.

“We watched every prison break movie ever made,” Johnson said. “Almost all those movies, the plot turns on logistics. When does the laundry come out? When does the shift change? When does the spotlight cross the yard?” But the involvement of Mitchell — everyone called her Tilly — made this story more universal. She is as trapped as the inmates.

“Instead of watching a scene like in ‘Mission: Impossible,’ you’re suddenly asking, ‘What am I stuck in?’ ” Johnson said. “ ‘Am I stuck in a job I don’t like? A prison I don’t like? A town I don’t like?’ ”

Stiller and the cast met with Sweat behind bars at a different prison. Dano said he was surprised by how forthcoming the inmate was about getting by in prison. “You can’t let your guard down,” he said. “You have to shut off parts of yourself and project something.”

Del Toro thinks Matt was the kind of inmate who ends up “feeling more comfortable in jail,” and that maybe he always assumed he’d be captured.

“If he went back, he’d have this story of a lifetime,” he said. “One hell of a story.”