“Rabbi to the stars” Marc Schneier is battling his soon-to-be ex-wife, Tobi Rubinstein-Schneier, to make sure she stays legally blocked from talking about their bitter divorce on a reality TV show with YouTube divorcée Tricia Walsh-Smith.

Walsh-Smith, 53, became an Internet sensation after she posted a 2008 YouTube video about her split from Shubert Organization president Philip Smith. Our spies saw the British blonde meeting with Tobi late last week on the Upper East Side. Walsh-Smith then told us she’s working on a TV show, “The Divorced Wives Club,” where women who survived bruising divorces advise others.

Our story set Schneier’s lawyers into action. They demanded a conference call with a Manhattan judge yesterday, during which Tobi was ordered to stick by a gag order while they negotiate their divorce.

A source told us, “The rabbi’s lawyers argued that Tobi talking about their divorce on TV or to anyone puts her in breach of the current gag order. The judge ruled she must not talk to any reality show until after their divorce is settled. Another gag order may be put in place as part of the settlement.”

Schneier, named by Newsweek as one of the 50 most influential American rabbis, is a founder of the New York Synagogue and the star-studded Hamptons Synagogue, and has acted as a spiritual adviser to Russell Simmons and Steven Spielberg.

But we revealed in June of last year that he’d split from fourth wife Rubinstein-Schneier after three years and was dating a speech therapist who was a former member of his congregation.

Rubinstein-Schneier’s lawyer, Susan Bender, did not return calls. A spokesman for the rabbi said, “The gag order is in place, remains in place and we will respect that by not making any comment.”

Walsh-Smith, who says she’s talking to US and British networks, added, “Because of this gag order, I am not sure Tobi can be in the show. I want the show to be feisty and go into battle. We are going to get these men in a way that will really hurt and humiliate them. The rabbi is on my list.”