A high-profile psychiatrist says she was fired by Yale University after repeatedly calling then-President Trump and his supporters mentally ill — and is now suing the college for unlawful termination.

Dr. Bandy Lee — who has been an analyst on CNN and written op-eds for the New York Times — was let go last May after being accused of "recklessness" and a "serious violation" of professional ethics, according to court papers.

Lee had been a constant alarmist over Trump’s mental health, penning a 2017 book, "The Dangerous Case of Donald Trump," and even raising her fears to lawmakers that same year.

The attacks continued even after she was fired — including a since-deleted tweet last November in which she compared Trump to Nazi leader Adolf Hitler, Fox News noted at the time.

"Donald Trump is not Adolf Hitler," the tweet read. "At least Hitler improved the daily life of his followers, had discipline, and required more of himself to gain the respect of his followers. Even with the same pathology, there are varying degrees of competence."

Her proclamations defy an American Psychiatric Association rule forbidding professional opinions about public figures who have not been examined, her own lawsuit admitted.

But Lee said that does not apply to her, because she is no longer a member of the group — and the rule is just an attempt to "gag" its members from vital public warnings.

Earlier this month she refused to comment on President Biden, writing that she does not "diagnose without examination … unless there is evidence of profound danger to public health and well-being."

After teaching at Yale for 17 years, Lee was finally confronted after one of Trump’s lawyers, Alan Dershowitz, made a formal complaint last January over a tweet accusing him of having a "‘shared psychosis’ among just about all of Trump’s followers."

Dershowitz wrote that Lee had "publicly ‘diagnosed’ me as ‘psychotic,’ based on my legal and political views, and without ever examining or even meeting me," the documents stated.

"This constitutes a serious violation of the ethics rules" of the APA, he wrote, suggesting she likely also violated Yale’s own rules.

Faculty heads warned her that she had "breached psychiatric ethics by ‘diagnosing'" Dershowitz from afar, the lawsuit said.

"The recklessness of your comments creates the appearance that they are self-serving in relation to your personal political beliefs and other possible personal aspirations," department head Dr. John Krystal warned in a letter, the lawsuit said.

"You are putting me in a position where I have to ask, ‘Is this the sort of person that I can trust to teach medical students, residents, and forensic psychiatry fellows?’"

When she was finally let go in May, Yale said it was because she "did not have a formal teaching role," the lawsuit said, calling it "pretextual."

Lee detailed her exit in her suit accusing Yale of unlawful termination "at the behest of Professor Alan Dershowitz … due to her exercise of free speech about the dangers of Donald Trump’s presidency."

"Since she was acting on a citizen’s duty to contribute her gifts to society … her speech is protected under the First Amendment," the lawsuit claimed.

"Trump’s presidency represented an emergency which not only allowed, but required, psychiatrists in the United States to sound the alarms," her legal team said of her "professional responsibility to protect society."

TRUMP'S MAR-A-LAGO REMAINS A FUNDRAISING MECCA FOR MANY REPUBLICANS

"Trump’s mental health was affecting the mental health" of everyone in the US, "placing the country at grave risk" and "undermining democracy itself," Lee had warned, the lawsuit said.

Lee’s legal action seeks reinstatement as well as more than $75,000 in "lost income, lost benefits, lost resources, lost privileges, lost indirect but significant remuneration, future economic losses, emotional distress, harm to reputation and loss of enjoyment of life."

Yale spokeswoman Karen Peart told the New Haven Register that Lee was not reappointed to her post after consideration of "Yale’s policies and practices."

"Yale does not consider the political opinions of faculty members when making appointment decisions," it insisted.

Dershowitz told the paper that "Yale was right to look into" his complaint, but the outcome was "their decision."

Lee "attributed to me a lot more power than I think I actually have. All I did was alert the Yale authorities to her unprofessional conduct. The facts are the facts," said Dershowitz, who has never met the psychiatrist.

"I think her own words prove that she acted unprofessionally, in violation of academic standards and in violation of the rules of psychiatry," Dershowitz said.

CLICK HERE TO GET THE FOX NEWS APP

"I also think that it is unethical to falsely diagnose somebody whom she hasn’t met for political and ideological reasons."

Lee told told the Yale Daily News that she filed the lawsuit "with a heavy heart."

"I love Yale, my alma mater, as I love my country, but we are falling into a dangerous culture of self-censorship and compliance with authority at all cost," she said.

To read more from the New York Post, click here.