“I was in a state of shock,” said Erin Gee, 44, who worked for CBS for 17 years and recently filed a Manhattan federal suit alleging rampant sex discrimination at the network.

Gee said one of the most offensive incidents occurred in 2011, when she was talking with her boss at “CBS Evening News,” Robert Klug, about a workplace dispute.

Klug, now 58, said “she should ‘have sex’ with [the] video editor who had been difficult to work with to ‘break the ice,’ ” according to court papers.

“I couldn’t believe that was his advice,” Gee said. “I was looking for help, and he looked at me like, ‘You don’t matter, and this is what you should do to make this guy like you.’ ”

Gee reported the incident to a senior producer on the program, “who told her at the time that he let the executive producer know about it,’’ said her lawyer, Kevin Mintzer. “But nothing was done.’’

Klug eventually was promoted to executive director for CBS News, and shortly after, another male boss told Gee that Klug “had asked him whether he had had sex with her or the other women under his supervision,” the suit says.

That boss “told me that story because he was very upset,” Gee said.

Fed up with the network’s “boys’ club,” Gee filed a formal complaint with CBS in 2015, again reporting Klug’s comments, as well as other instances of alleged sexism.

“All I wanted was the same opportunities that were being given to the men. In my nearly 20 years at CBS, I never saw a female director direct the evening news,” she said.

But after she filed the complaint, Gee was demoted to the weekend newscast, according to court papers.

She was told she was being disciplined for “behavioral problems,” but Gee says she was never alerted to any issues.

The federal Equal Employment Opportunity Commission dismissed Gee’s discrimination claim in March, saying it was “unable to conclude that the information obtained establishes a violation of the statutes.”

But the EEOC still issued a right to sue, which is required under federal law.

Gee is seeking unspecified damages in her suit.

A CBS spokeswoman called Gee’s allegations “wholly without merit, including those directed toward Mr. Klug.”

“Contrary to those allegations, Ms. Gee was treated in a nondiscriminatory and nonretaliatory manner,” the spokeswoman said.

Klug did not return calls seeking comment.

Gee’s allegations come days after a slew of women accused Rose, then a host of “CBS This Morning” and of PBS’ long-running “Charlie Rose” talk show, of sexual harassment.

Both CBS and PBS dropped Rose immediately after the allegations came to light, with CBS News president David Rhodes writing in a memo to staffers that the allegations were “extremely disturbing and intolerable.”

“There is absolutely nothing more important, in this or any organization, than ensuring a safe, professional workplace — a supportive environment where people feel they can do their best work. We need to be such a place,’’ Rhodes wrote.

Rose has apologized for “inappropriate behavior’’ but added, “I do not believe that all of these allegations are accurate.’’