Daniel Radcliffe is playing an angel in his latest role, but in real life, he doesn’t believe in God.

“I personally am agnostic leaning toward atheism,” Radcliffe tells The Post. “I don’t expect there to be a God and an afterlife — I would be pleasantly surprised if there was.”

Why is Harry Potter discussing theology? It’s the subject of “Miracle Workers,” an afterlife comedy set in a bureaucratic version of heaven. Premiering Tuesday (10:30 p.m. on TBS), the seven-episode show follows God (Steve Buscemi), who decides to destroy Earth. To save it, Radcliffe’s character — Craig, a low-level angel who answers prayers from a dark basement office — must step up.

“There was a time when I was in my teens when I was kind of irritatingly belligerent about atheism,” says Radcliffe, 29. “And I’m just not anymore. I’ve had too many friends for whom their faith has really helped them at hard times in their life.

“I’m fully aware that religion is a huge part of a lot of people’s lives,” he says. “Everyone can believe whatever they want, as long as it’s not hurting anyone and as long as you don’t think that gives you the right to tell someone else how they can live their life.”

Radcliffe’s own life these days is bi-continental. He resides in London with his longtime girlfriend, Erin Darke, 34 (“The Marvelous Mrs. Maisel”). But he’s a frequent visitor to Broadway, where he’s starred in four productions — the latest, “The Lifespan of a Fact,” opposite Bobby Cannavale.

“Generally speaking I’m still based out of London,” he says. “But I love New York. I try to find as many excuses as I possibly can to be there all the time, because it’s just the best.”

Although he doesn’t believe in an afterlife, he and his angelic character have a few things in common — a flood of mail among them. In “Miracle Workers,” Craig is overwhelmed by prayers, which arrive on slips of paper, much like the owl posts in the “Potter” films.

But it’s also an echo of the actor’s own life. At first, the volume of fan mail was overwhelming, he says, even though it wasn’t “quite the onslaught” that Craig has to deal with.

He says he and his family now have someone handling his mail, but initially, he says, “we’d find friends of friends who might have been out of work, and didn’t mind stuffing signed photos and newsletters into stamped, addressed envelopes and sending them back off to people.”

Having now performed on screens large and small, Radcliffe says he doesn’t see much difference between the two. But acting on the stage, he says, is different: “Theater makes me a better actor every time I do it.”

And while comedy might seem like a departure for someone known for fantasy, horror and avant-garde films (“Harry Potter,” “Horns” and “Swiss Army Man,” respectively), Radcliffe says he’s been itching to show the world his light side for years. His favorite TV shows include “The Office” (both the American and British versions), “30 Rock,” “Parks and Recreation,” “BoJack Horseman” and the ’80s British series “Yes Minister.”

“A lot of what I watch and what I grew up watching was comedy,” he says. “I’ve done comedy onstage, so some people have seen me do it. But not for an audience this wide. So I was really excited to try and show that side of myself as an actor.”