A federal judge on Friday threw out a lawsuit against Housing and Urban Development Secretary Ben Carson and his agency, dealing a blow to advocates challenging how the department enforces fair housing laws.

Chief Judge Beryl A. Howell, of the U.S. District Court for the District of Columbia, dismissed the case after finding that the plaintiffs, three housing advocacy nonprofit groups, failed to prove they were harmed by HUD’s move to effectively suspend an Obama-era rule requiring communities to address housing discrimination.

Howell, an Obama appointee, disagreed with the plaintiffs’ allegations that Carson had dismantled the 2015 rule in May when he withdrew a computer assessment tool that allowed the agency to oversee whether communities complied with the law.

“Many aspects of the [Affirmatively Furthering Fair Housing] Rule remain active,” Howell wrote in her 77-page opinion. “HUD’s withdrawal of the tool does not ‘perceptibly impair’ the plaintiffs’ abilities to carry out their missions.”

The 2015 rule, developed over a six-year period, was designed to push communities to comply with a little-enforced provision of the 1968 Fair Housing Act that compelled local governments to use federal dollars to end residential segregation. The rule required more than 1,200 communities receiving billions of federal housing dollars to draft plans to desegregate their communities — or risk losing federal funds.

Local governments were supposed to use the computer assessment tool to analyze housing patterns, concentrated poverty and disparities in access to transportation, jobs and good schools. They were to identify discriminatory barriers and actively fix them.

“It has only been for the last three years that communities were equipped with the tools and guidance needed to meet their obligations under the law,” said Diane Yentel, president of the National Low Income Housing Coalition.

Howell said the court does not have the jurisdiction to “micromanage agency choices on program implementation” when the plaintiffs have not proved sufficient harm.

Housing advocates said Howell’s ruling allows HUD to revert to a toothless enforcement system that has failed to ensure that communities receiving federal housing dollars adhere to fair housing law. Several federal reports have documented that the previous monitoring method — which amounts to little more than communities self-certifying that they had taken actions to overcome impediments to fair housing — actually perpetuated housing segregation.

“Without effective enforcement, you get situations where municipalities and housing authorities are continuing to engage in discrimination,” said Lisa Rice, president and chief executive of the National Fair Housing Alliance, one of the three plaintiffs.

The ruling, Rice said, means that communities will continue receiving federal dollars without eliminating barriers to housing discrimination.That means municipalities like Zanesville, Ohio, which denied water services to communities of color, or those like Houston, where black and Latino neighborhoods suffer inferior drainage services, could still receive federal funds in the absence of individual lawsuits.

“There are very real negative impacts here,” Rice said. “Their houses are infected with mold. Their children are suffering from asthma.”

HUD on Saturday released a statement to The Post, saying the agency remains “deeply committed to the Fair Housing Act and will continue to live up to the spirit and the letter of the law.”

"We are gratified that the Court agreed with HUD on all points, including the agency’s approach to amending the Affirmatively Furthering Fair Housing Regulations,” the statement said.

Carson has long criticized federal efforts to desegregate American neighborhoods as “failed socialist experiments” and previously dismissed Obama-era reforms as compelling communities to look around for “anything that looks like discrimination.”

The agency on Monday announced it plans to amend existing fair housing regulations. It is seeking public input for new rules that federal officials say will minimize regulatory burdens, allow for greater local control and innovation, place less emphasis on analysis and increase housing choice by expanding housing supply.

HUD officials, in Monday’s notice, said the 2015 rule “proved ineffective, highly prescriptive, and effectively discouraged the production of affordable housing.”

The agency in January had suspended the obligation of local governments to file plans on how they would integrate neighborhoods.

In May, shortly after the lawsuit was filed, HUD withdrew the computer assessment tool to be used for those plans because it was “confusing, difficult to use, contained errors,” and “required an unsustainable level of technical assistance.”

“HUD’s 2015 rule often dictated unworkable requirements and actually impeded the development and rehabilitation of affordable housing,” Carson said in a statement. “We do not have to abandon communities in need. Instead we believe we can craft a new, fairer rule that creates choices for quality housing across all communities.”

Sasha Samberg-Champion, lead attorney on the lawsuit, said the agency’s formal rulemaking notice on Monday is just another way to “dismantle the 2015 rule by procedurally more defensible means.”