Click to email this to a friend (Opens in new window)

Click to share on Twitter (Opens in new window)

Click to share on Facebook (Opens in new window)

The Manhattan judge overseeing “Real Housewives of New York” star Bethenny Frankel’s bitter custody battle accused her ex-husband of “exploiting” the tragic death of the TV personality’s boyfriend.

Jason Hoppy had asked Manhattan Supreme Court Justice Michael Katz to order drug testing for Frankel after her boyfriend Dennis Shields died of a suspected drug overdose in August.

“There was a tragedy which I think you’re trying to exploit to embarrass Ms. Frankel,” Katz lectured Hoppy in denying the request for drug testing.

Hoppy’s lawyer, Robert Wallack, had argued that in addition to Shields’ death, Frankel had “posted a video of herself on Instagram where she was clearly intoxicated and slurring her speech” last week.

She also “appeared on TV passed out from mixing alcohol with Ambien,” Wallack said, referring to “Holidazed and Confused,” the May 30 episode of Frankel’s Bravo show, Wallack said.

“If this is what she’s putting out in public, we don’t know what she’s doing in private,” Wallack said.

Frankel’s attorney, Allan Mayefsky, insisted his client didn’t have a substance abuse problem.

“She’s on television, she’s entertaining. It’s her livelihood to say, ‘I’m out with friends having a good time,’” Mayefsky said.

The judge expressed skepticism about the timing of Hoppy’s drug testing demand, which he made only after the judge granted Frankel’s request for a custody trial.

The ex-couple had agreed to share parenting time with their 8-year-old daughter, Bryn, in 2016, but Frankel moved for full custody last year after Hoppy was charged with stalking her.

The custody trial is set for March.