Over the past two years, as Ishan Bhabha and his colleagues at the law firm Jenner & Block prepared briefs for the affirmative action case the Supreme Court ruled on last year, Mr. Bhabha had a realization: If higher education institutions like Harvard were the first target of litigation about diversity, equity and inclusion, America’s corporate boardrooms were probably next.

Mr. Bhabha began working with dozens of Fortune 500 companies to evaluate their diversity programs and ensure that they were on solid legal ground if they were sued.

Proponents of corporate diversity, equity and inclusion programs, commonly called D.E.I., argue that they are important to hiring and retaining people of color. Critics now argue that some such programs can exclude white and Asian people unfairly from hiring processes.

In recent months, hundreds of companies have been re-examining those initiatives after a series of challenges to diversity programs: the threat of litigation in the wake of the Supreme Court’s decision striking down race-conscious college admissions, criticism of D.E.I. initiatives from some high-profile business leaders, and a wave of layoffs in the tech industry that heavily affected D.E.I. teams.

This pushback — which has come as more than 20 states weighed or passed new laws last year targeting D.E.I. initiatives — has had a chilling effect on some corporate D.E.I. offices, according to diversity advisers.

“When the economy is booming and when the politics are amenable, we see a lot of growth in diversity programming,” said Frank Dobbin, an expert on D.E.I. at Harvard and author of the 2022 book “Getting to Diversity.” “When there’s either a change in the political winds — which is what’s happening now — or a recession, we’ve seen cutbacks.”