Having been “bored s - - tless” the first time he saw “The Magic Flute,” Barrie Kosky hoped never to suffer through it again.

Granted, he was only 11 at the time but, thanks to his grandmother, he’d seen dozens of operas he loved as a child in Australia. Mozart’s three-hour-long blend of fantasy and reality — with its lengthy chunks of German dialogue — wasn’t one of them.

So imagine Kosky’s horror when, as the newly appointed director of Berlin’s Komische Opera in 2010, he was told to stage “The Magic Flute.” “I can’t!” he said.

Luckily, someone took him to see a show by a British theater company called 1927 that had a mix of live performance and animation that blew Kosky’s mind. “Within 30 seconds,” he says, he knew how to present the opera he’d feared.

Two years later, he and 1927’s Suzanne Andrade and Paul Barritt unveiled their version of Mozart’s opera. A nippy two hours, it replaced the original’s lengthy speeches with short, silent-film-like titles. Singers interact with cartoons, the Queen of the Night is a giant spider and the hero’s hapless sidekick, Papageno, looks like Buster Keaton.

Now, after playing 22 other cities, this “Magic Flute” opens in New York on Wednesday, July 17, at the Mostly Mozart Festival. A singer who’s been with the show from the beginning, Maureen McKay, formerly with New York City Opera, says she’s sung the role of Pamina in four other productions. She calls this the most “cardiovascular” of them all.

“There’s a lot of running,” the soprano tells The Post. Behind the wall we see onstage are staircases leading to six doors, some as high as four stories up.

“You feel like you’re on a mountain,” McKay says. “They built harnesses under our costumes, the stagehands buckle you in and then you step out of the door and sing.”

Coordinating your movements with the animation around you takes exquisite timing, she says: “When I throw my arm out in the suicide scene, it has to be exactly the right place against the wall, so the [cartoon] blood coming out of my wrist will come from the right place!”

Attempted suicide aside, this “Magic Flute” plays out like a romantic comedy from the silent-film era, full of fun and slapstick.

“There’s quite a lot of British humor in it,” says Barritt, the animation artist. “I think Mozart was a funny guy, and if he was around, I think he’d quite enjoy our version.”

“The Magic Flute,” July 17-20, David H. Koch Theater; LincolnCenter.org/Mostly-Mozart-Festival