In an interview, Mr. Bernanke and the new president, Janet L. Yellen, his successor as Fed chair, said the association would soon finalize procedures for investigating violations of its code of conduct and for punishing violators. One formal complaint has already been filed, they said.

Mr. Bernanke said further steps might be needed to diversify the profession’s power structures, still dominated by white men (although a majority of the association’s executive committee, with Ms. Yellen’s ascension, is female). Additional efforts could include grading university economics departments on their diversity efforts, and insuring racial and gender diversity in top positions at leading journals, which can make or break economists’ careers by choosing to publish or reject their research.

Economics is grappling with these issues as other academic disciplines are facing their own reckonings. The National Academy of Sciences in 2018 published a report finding widespread sexual harassment in science, engineering and medicine. Prominent scholars in political science, government, law and other fields have been accused of sexual harassment. But gender and racial gaps in economics are wider — and have been more stubborn — than in many other fields.

The lack of diversity in economics, particularly in the top ranks, is nothing new. But the discipline has been forced to confront its problems by a series of incidents in recent years. In 2017, an economics student, Alice Wu, published a paper documenting discrimination, harassment and bullying on a popular industry online forum. The following year, Roland G. Fryer Jr., a star economist at Harvard, was accused of harassing and bullying women at his university-affiliated research lab. (Harvard suspended Mr. Fryer last year.)

At the economics association’s meeting last year — less than a month after The New York Times published details of the claims against Mr. Fryer — some of the field’s most prominent women shared searing stories of harassment and discrimination. And in March, the association published the results of a survey finding that female and minority economists faced rampant bias, harassment and even outright sexual assault.