Fashion giant Zara fosters a racist atmosphere in which management ​traded offensive ​emails, ​including one depicting ​President Obama in a KKK hood, ​and an Aunt Jemima pancake mix box ​with ​a Confederate flag ​superimposed on it, according to a new lawsuit by the company’s former head lawyer in the ​United States.

Ex-general counsel for the US and Canada Ian Jack Miller filed the damning, $40 million discrimination lawsuit against the world’s largest fashion retailer in Manhattan Supreme Court on Wednesday, claiming he was fired for being Jewish, gay and American.

Zara’s founder, Amancio Orteg​​a​ — who surpassed Warren Buffet as the world’s second-richest man Wednesday with a net worth of $71.5 billion​, according to Bloomberg ​— favors employees who are like him, “straight, Spanish and Christian,” according to court papers.

Zara’s ​allegedly ​bigoted underbelly showed itself after international outcry prompted the company to pull children’s pajamas that resembled concentration camp uniforms from its racks, Miller notes.

The retailer has also peddled handbags depicting swastikas, necklaces containing figurines in blackface, and a T-shirt proclaiming that “White is the New Black,” he says.

The McGill University and Baruch College grad was fired in March after complaining that supervisors sent him homophobic emails and made anti-Semitic remarks.

One email included a highlighted statement that called marriage an institution “sanctified between a man and a woman,” the suit says.

In another instance, a manager “spoke with senior executives about prostitutes, openly criticized transgendered individuals and demeaned gender non-conformism,” according to court papers.

Colleagues also expressed “shock” when they learned Miller​ — who keeps kosher and lived on a​n Israeli​ kibbutz as a teen​ ​— was Jewish, the suit says.

And that was before the CEO and a director “would openly deride Jewish landlords and Jewish real estate developers.” The director “would roll his eyes while reciting the phrase ‘los judios’ and complain about how difficult it was to negotiate with ‘those people,'” the suit says.

As for the derogatory Obama depictions, Miller claims “senior executives at Zara openly used racist slurs and exchanged racist emails, including emails portraying Michelle Obama serving fried chicken and emails depicting Barack Obama in a Ku Klux Klan hood, with a Confederate flag … on an Aunt Jemima box, and shining shoes,” the suit says.

A higher-up also made it clear that “Spanish employees ‘get more chances’ than non-Spanish employees at Zara,” according to the filing.

Miller says he was fired on March 5 — just one day after the company received a letter from his lawyer complaining about “unlawful discrimination based on [his] religion, national origin, and sexual orientation.”

Just a year before his ouster, Miller says, he received 110 percent of his target bonus and always won strong performance reviews.

A Zara spokesman said, “The allegations contained in a plaintiff’s press release today are shocking, and – although we have not yet seen a copy of the lawsuit – we will respond strongly and vigorously to these allegations in the Court.

​We do not tolerate any behavior that is discriminatory or disrespectful, but value each individual’s contributions to our dynamic organization.”