A contestant on "The Apprentice: Martha Stewart" (search) has known one of the show's judges for years and had a steamy relationship with the judge's son.

Bethenny Frankel, owner of a New York cookie company and one of 16 wannabe Marthas vying for a $250,000 job on the upcoming NBC reality TV show, dated Brian Koppelman (search), whose father, Charles Koppelman (search), is part of the team that decides which contestants get canned each week on the show.

The elder Koppelman is chairman of Martha Stewart Living Omnimedia (search) — whose stock jumped 12 percent Thursday after Stewart announced at a press conference, "We're back on track."

NBC officials say Charles Koppelman and Stewart's daughter, Alexis Stewart (search), serve as the ex-con's "eyes and ears" during each week's task. Then they join her in the conference room to help decide who gets fired. The pair works much like George Ross and Carolyn Kepcher do on Donald Trump's "Apprentice."

Frankel, 34, first got to know the Koppelman clan when she and Brian Koppelman, 39, dated about 10 or 15 years ago, sources say.

"The situation is dealt with in the first few minutes of Episode 1," said a spokesman for Mark Burnett Productions. "Viewers will have to tune in to see what happens."

Frankel directed questions to NBC.

Charles Koppelman first learned that Frankel would be a contestant five days before shooting began, said a source on the set. At that point, the producers could have flown in an alternate contestant but chose to stick with Frankel because she was so charismatic, the source said.

Frankel and Koppelman dated during a period that likely overlapped with Charles Koppelman's tenure as chairman and CEO of EMI Music.

The younger Koppelman, then an artists' rep at EMI, made his name discovering singer Tracy Chapman.

Frankel, who grew up in New York, founded healthy-cookies company Bethenny Bakes in 2001 after running an event-planning company in L.A.

In an interview last year with The (Albany) Times Union, Frankel said, "I want to be the Martha Stewart of the health-food industry — without the jail."

In her role as event-planner to the stars, Frankel palled around with everyone from actress Mimi Rogers to model Cindy Margolis.

"Bethenny will win Martha Stewart's new 'Apprentice' because she is talented, creative, motivated [and] charming," Margolis told The Post. "Any girl who asks the bride first if she can wear a sexy dress to her party has brains!"

Frankel is the daughter of world-renowned horse trainer Bobby Frankel, who grew up in Brooklyn and got his start as a gambler.