Jennifer Lopez was recently in talks for a $90 million Las Vegas residency — but the blockbuster deal now looks shaky at best as her new album and upcoming concert tour are flopping badly, The Post has learned.

The embattled pop diva — whose headline-grabbing marriage to Ben Affleck is reportedly crumbling — recently had been in talks with MGM Grand on a guaranteed $1 million a show for 90 dates starting next year, a source close to the situation told The Post.

But casino executives have lately grown skittish over abysmal ticket sales for her first tour in five years following the release of her “This is Me … Now” album in February — with poor demand having forced the cancellation of seven shows this summer, the source said.

No Vegas deal has yet to be announced. That’s despite a report from The Mirror on Feb. 2 that MGM had teamed up with Live Nation to offer more than $800,000 a show.

Rival casino Resorts World upped the bidding to $875,000 per show in partnership with Anschutz Entertainment Group (AEG) soon after, sources said.

MGM and Live Nation then swooped in with the $1 million-a-show offer for the “Let’s Get Loud” singer — but buyer’s remorse has lately set in, the first source said.

MGM is watching her not doing well on the road. They are very nervous,” the person said. “Its pretty rare you have a poor tour and then go to Vegas.

Now, the Bronx-born star could be looking at a significant haircut to the $90 million windfall. A Lopez residency should fetch just $600,000 to $650,000 and be for fewer shows, the source said.

Another source with knowledge of the MGM talks said no deal was ever signed, but discussions have continued.

Reps for Lopez and MGM did not comment.

The latest album was the worst selling of Lopez’s career and a companion film on Amazon Prime Video was panned. Ticket sales for the concert, which kicks off next month, are poor and her love affair with Affleck is apparently on the rocks.

Subscribe to our daily Business Report newsletter!

Please provide a valid email address.

By clicking above you agree to the Terms of Use and Privacy Policy.

Never miss a story.

The couple has rarely been seen together in recent weeks and he failed to show up for the premiere of her new film “Atlas,” which debuted on Netflix on Friday — and which The Post gave a one-star review.

MGM brass are worried about Lopez’s fading star power and whether she’ll be able to fill its 5,200-seat Park Theater to justify the massive financial commitment, the source said.

Lopez is having trouble filling the 19,500-seat T-Mobile Arena in Las Vegas for the tour stop on July 20, with a third of the high-priced floor tickets and plenty of cheaper options — some as low as $65 — still available, Ticketmaster shows.

Seven tour dates in cities including Atlanta, New Orleans and Houston were scrapped, Variety reported.

The Live Nation-produced tour concludes Aug. 17 at Madison Square Garden in New York City and the residency was expected to begin about six months after the tour ended, the first source said.

J.Lo and her manager Benny Medina began shopping for a Vegas venue before the singer dropped her new album and a companion film on Feb. 16, the source said.

Lopez was a good bet for a casino in the past. Caesars paid her about a guaranteed $500,000 a show for a Planet Hollywood residency that ran for 120 shows between 2016 and 2018.

It grossed $101.9 million, making it the sixth highest Las Vegas residency of all time, and the top residency by a Latin artist, according to Billboard.

MGM is paying Mariah Carey just $500,000 a show for her current residency. Giving Lopez twice that amount would put her in the same ballpark as recently signed deals for Bruno Mars and Lady Gaga.

Adele got a record-breaking $2 million a show at Caesars Palace, The Post reported exclusively last year.