Bill Murray popped up at “Groundhog Day” last week, triggering some fun publicity and boosting ticket sales.

Alas, the boost was too little, too late.

Despite its seven Tony nominations, the musical will close Sept. 17 after just 176 performances, The Post has learned.

“Groundhog Day” is the second high-profile Broadway show to collapse in the past week. “Natasha, Pierre and the Great Comet of 1812” is closing Sept. 3 after a bruising racial backlash over the attempt to replace Okieriete “Oak” Onaodowan with Mandy Patinkin.

The demise of “Groundhog Day” isn’t nearly as dramatic, but it is heartbreaking. This is not an embarrassing flop that deserves to close. It’s an ambitious, well-crafted, entertaining musical that, for various reasons, never gained traction.

The team that put it together is first-rate: composer Tim Minchin, director Matthew Warchus and writer Danny Rubin, who co-wrote the 1993 movie. The show also had a star-making performance by Andy Karl as the cynical weatherman Phil Connors.

After it opened to rave reviews last year in London, it became the odds-on favorite to sweep the 2017 Tony Awards. I wrote a column a year ago headlined, “Broadway producers are terrified of ‘Groundhog Day.’”

But that was before “Dear Evan Hansen” opened in the fall, to rave reviews and tremendous word-of-mouth. Leading man Ben Platt became a sensation. By the time “Groundhog Day” began previews in March, “Evan Hansen” had amassed a $40 million advance.

Technical glitches plagued “Groundhog Day” at the start, as sets malfunctioned, eclipsing the story the producers wanted to get out, about Karl’s terrific performance.

He did grab headlines, though not in the way anyone intended. Right before opening night, he tore his ACL during a performance. He soldiered on, visibly in pain, to the end of the show, took a couple of days off and then returned to do the show on a cane.

The audience — and Tony voters — cheered him on, but ticket sales never took off.

“Groundhog Day” couldn’t even position itself as a rival to “Evan Hansen.” That slot fell to another surprise hit: “Come From Away,” a hit with audiences from its first performance. “Groundhog Day” was sidelined and left the Tonys empty-handed.

Its producers hoped to keep the show going into the fall, praying that it could gain a foothold with other shows — “Comet,” “Bandstand” — falling away. But over the weekend, they decided “Groundhog Day” was simply too expensive to run.

Producers hoped to keep the show going into the fall, praying that it could gain a foothold with other shows. But they decided ‘Groundhog Day’ was simply too expensive to run.

There was a warning of that early on when Scott Rudin, one of Broadway’s most powerful producers, severed ties with the show last spring. Sources at the time said he was concerned about the numbers. Originally budgeted at $16.5 million, the show, sources say, ended up costing nearly $20 million on Broadway.

Nearly all of it will be lost.

Speaking of losses, investors in “Comet” are baffled that their show, which was grossing more than $1 million a week, will return only 20 percent of its $14 million costs. They’re demanding an audit.

Every Broadway show gets audited at some point, but it’s unusual for investors to agitate for one so soon. The producers of “Comet” declined to comment.

But sources say that what the investors will discover is that the running cost of the show — put at about $545,000 in offering papers — soared to more than $700,000.

With that sort of overhead, you need a star to put bodies in the seats. Hey, what about Mandy Patinkin?