It was Fourth of July weekend, but the fireworks were going off inside David and Libbie Mugrabi’s $3.75 million home in Water Mill, LI.

According to a female houseguest, Libbie barged into a bedroom where the woman was packing up her belongings.

“She said, ‘I am Mrs. Mugrabi,’ ” recalled the houseguest.

“I said, ‘I know you’re Mrs. Mugrabi. I’m not trying to be Mrs. Mugrabi.’ ” Behind Libbie, her nanny stood filming the encounter.

The tension had been brewing since the night before, when Libbie, 39, and her husband, art mogul David, 47 — whose family owns a $5 billion art collection — hosted a dinner party at their 7,000-square-foot home. At the end of the evening, according to the houseguest, six individuals, including David, decided to frolic nude in the outdoor swimming pool while Libbie slept upstairs.

“It was fun. It was nothing sexual. As if we were teenagers,” said the houseguest, an art-world associate of the Mugrabis’.

“The next morning, everyone was hung over. We were saying, ‘Wow, that was crazy last night,” she continued.

“It was fun. It was nothing sexual. As if we were teenagers. The next morning, everyone was hung over. We were saying, ‘Wow, that was crazy last night.' ”

— Houseguest of the divorcing Mugrabis

The houseguest said Libbie didn’t appear bothered by the skinny-dipping at first, but then suddenly turned on her.

“I honestly think she used me as a tool . . . to get leverage in [her] divorce,” said the houseguest. “She was like, ‘What’s your relationship [with my husband]?’ She was putting words in my mouth, and I was really scared because she started to threaten me with my job and a community of collectors I work with.”

It’s just one more incendiary story in what is now NYC’s nastiest divorce.

So far, Libbie has accused David — her husband of 14 years and father of their two children — of physically assaulting her when he caught her trying to move a $500,000 Keith Haring sculpture out of their home. Meanwhile, to Libbie’s surprise, David had transferred ownership of their $72 million Upper East Side town house into an LLC controlled by his older brother, Alberto.

The Manhattan Supreme Court proceedings, which began in September, have been a circus, with Libbie screaming at one October court date that David was going to kill her. She also lugged in the 25-pound Haring sculpture, which the couple had “wrestled” over, according to a witness who also claimed David repeatedly pushed a door into Libbie.

Shockingly, for a couple said to have spent $3.5 million annually, they had no prenup in place.

Rumors of infidelity have been swirling around both husband and wife, including allegations, reported in the Jewish Voice, of David having a 26-year-old mistress.

“I think it is certainly the nastiest divorce of my group,” said one NYC socialite. “I didn’t know people like us did this.”

“I think it is certainly the nastiest divorce of my group. I didn’t know people like us did this.”

— New York City socialite

The Mugrabis’ marriage wasn’t supposed to end this way.

The two were fixed up after Libbie’s mother, who works as a nurse at SkinTight MedSpa in Manhattan, met David on a flight to Aspen. At the time, Libbie was 21 and in culinary school.

“[Libbie and David] met in Aspen and six months later they got engaged,” said a family friend. The wedding was a 600-person affair at The Pierre hotel, with arat bigwig guests including art gallerist Larry Gagosian.

“In those days, she was the sweetest, so nice,” said the socialite.

But as Libbie — who grew up in Ocean Township, NJ, with her mother, plastic-surgeon father and sister — became more comfortable in the super-moneyed world she married into, insiders say she changed.

“[David’s family] tried to take her in and . . . [make her] forget she had her own family,” said the family friend.

David’s father, Jose, who was born in Israel, made his fortune in the textile business while living in Colombia. When he moved to New York in 1982, he began buying art, amassing the largest Warhol collection in the world. He and his wife, Mary, have two sons, Alberto and David.

David, who now buys and sells his family’s artwork, attended Babson College in Boston before heading to Wall Street as a broker. While David is considered the more reserved of the two brothers, all the Mugrabis live well — and large. Alberto’s lavish South of France wedding in September 2016 is rumored to have cost up to $20 million, with guests including the Olsen twins, Owen Wilson and Aby Rosen. Members of the Mugrabi family have reportedly been painted by artists such as Richard Prince, whose work goes for millions.

“They were living the highest life you can imagine,” said the family friend of David and Libbie. “A lot of staff. A lot of nannies, a lot of cleaning people and chefs. Two homes, a lot of drivers and the ­[Mugrabi] family airplane.”

“They were living the highest life you can imagine. A lot of staff. A lot of nannies, a lot of cleaning people and chefs. Two homes, a lot of drivers and the ­[Mugrabi] family airplane.”

— Family friend

When the socialite learned that Libbie had employed a personal secretary, she was flabbergasted.

“What? Little Libbie who doesn’t even know her way around Bergdorf’s? I think [David] created a monster,” she said.

During an Oct. 9 court appearance, ­David’s lawyer claimed that Libbie spent “$6,000 to $7,000 for a personal trainer” during her last vacation.

“Libbie is a big fashionista,” the family friend said. “He didn’t like paying for that.”

According to the family friend, David ran a tight ship when it came to finances — and familial matters.

“He controls everything,” said the family friend, claiming that Libbie’s own mother was instructed to make an appointment to visit the couple and their children, 11 and 9, at the three-bedroom Upper East Side condo they lived in while the townhouse underwent renovations.

“It was David’s rule,” said the family friend. “He set these boundaries.” (David did not return requests for comment. )

Libbie apparently was blindsided when she learned that David had cut her out of the ownership of the townhouse, which they purchased together in 2013 for $15 million — and which they spent a whopping $57 million renovating.

In August, the judge declared that David cannot be blocked from selling the lavish townhouse, or 50 works of art, because they are owned by LLCs.

Libbie retaliated, filing a lawsuit against David, the Mugrabi Family Trust and Alberto earlier this month arguing that her husband surreptitiously gave his brother sole ownership of the townhouse’s LLC as a “fraudulent scheme to deprive her of her marital interest in the home,” according to the lawsuit.

“She had no idea,” said the family friend. “She was fixing the house up for five years, every day, working on that townhouse. It was just a sneaky maneuver. That was her home.”

Libbie’s world as she knew it began to fall apart on July 10.

She was dining at Bilboquet on the Upper East Side with her sister, Mia Rowe, and friend Lauren Amar when she received a call mid-meal from someone at her Hamptons house.

“[Libbie] said, ‘What do you mean everything’s gone?’ and she started to grab her things and she kept saying, ‘I don’t understand, I don’t understand,’ ” Amar testified in court.

“We asked if everything was okay and she said, ‘No,’ and proceeded to say that all of her artwork was gone, and she left,” said Amar.

The previous morning, David had arranged for hundreds of millions of dollars worth of art to be removed from their Hamptons house when Libbie was off the premises.

After Libbie fled Bilboquet, Amar and Rowe followed her to her Upper East Side apartment where they found their friend sprawled on a couch in her dressing room, crying.

“This is real; this divorce is clearly happening,” Amar recalled her saying. “I don’t know how I’m going to support myself or pay an attorney. He’s taken everything out of the house.”

According to Amar, Libbie collected valuable items from around the apartment, including a Basquiat plate she and David received as a wedding gift, jewelry and the Keith Haring sculpture, which Rowe advised her to snatch.

“She should take what’s hers,” Rowe said on the stand.

When David returned home, he and Libbie ended up wrestling over the Haring sculpture, Amar testified.

David shouted: “You’re taking my things!” Libbie was pushed to the floor and yelled for Rowe to call 911, according to the testimony.

Amar said David shoved his estranged wife out of the apartment. Once Libbie, Amar and Rowe were in the hallway, David opened the door twice and called the women “lowlifes” and “gold diggers.”

Some sources say Libbie is distraught by the separation. During visiting weekend at her children’s two camps in Maine, she was moaning to her well-heeled friends about the divorce.

“She told anyone who listened about it,” said the socialite.

Despite her heartache, insiders said Libbie has been seen around town with advertising executive and television personality Donny Deutsch.

Libbie denied the relationship is, or was, romantic.

“We’re friends, at best. We’re not even friends,” she told The Post. “I’ve never had an affair on my husband. I don’t believe in adultery. I’m a religious Jew.”

A rep for Deutsch told The Post: “Mr. Deutsch has been friends with Ms. Mugrabi for a long time. They’ve never had any other kind of relationship.”

According to the family friend, “It’s a friendship. [Libbie and Deutsch] never had sex and that is it. And they never had an affair, although David Mugrabi would like to think they did.”

The houseguest, for one, believes the stresses of the divorce are wearing Libbie down. “I think she’s totally f–king crazy at this point,” said the houseguest. “I know the divorce is probably hitting her hard, but the way she’s acting at this point is unbelievable.”

In August, Page Six reported that the judge ordered David to pony up $25,000 a monthin spousal support to Libbie — a downgrade from the $3.5 million-a-year lifestyle she claimed to be accustomed to in court papers.

Friends of the couple just want to see the duo hash things out, quickly and quietly. “I’d tell both of them to get this thing over with as soon as possible,” said attorney Perry Weitz, a friend of the estranged couple.

“David is sick about it also. He’s absolutely sick about it. He’s sick about everything about it. What it’s doing to the kids, what it’s doing to them. He’s going to see her the rest of his life, he wants to have a nice relationship with her.”

Additional reporting by Julia Marsh