The modest white house on Arlene Avenue in Dayton, Ohio, was an eyesore. The paint was peeling, and parts of the shutters were missing. The yard was thickly overgrown, and the back door, such as it was, had been jury-rigged from plywood.

The home on Jeanette Street in New Orleans didn’t look much better, with its broken steps, exposed wiring and vines sprouting from the gutter.

And the pale-green property on 64th Avenue in Oakland, Calif., ticked off many of the same complaints: broken windows, damaged fence, rotten wood, peeling paint.

Each of these homes, among more than 2,300 foreclosures around the country visited by fair-housing testers between 2011 and 2015, sits in a census tract that is overwhelmingly nonwhite. Nonprofit housing advocacy groups allege in a federal district court lawsuit filed in California this month that the lender responsible for maintaining them, the quasi-government agency Fannie Mae, allowed them to deteriorate.

The organizations, led by the National Fair Housing Alliance, say that Fannie Mae has systematically failed to care for houses in foreclosure in minority neighborhoods while ensuring that those in working- and middle-class white communities were well tended and ready for sale. The lawsuit says these racial disparities in the foreclosure crisis arose well after the predatory lending that forced many families out of their homes. The disparities also appeared in scenes of vacant homes once those families left.

Using criteria similar to Fannie Mae’s own maintenance checklist, investigators tallied the number of problems with each property — a broken gutter, a missing mailbox, an unmowed lawn — and concluded that foreclosures in predominantly minority neighborhoods were more likely to rack up deficiencies.

Foreclosures in predominantly nonwhite neighborhoods recorded more maintenance problems National Fair Housing Alliance, Census

The case is largely about the second-order casualties of foreclosure: the neighbors who live next door, the depressed value of adjacent property and the local housing markets that have recovered slowly where vacant properties accumulated. These cascading consequences, the lawsuit claims, have disproportionately fallen on minority neighborhoods.

“People looking at this from the outside say, ‘Well, those homes were in bad condition,’ or ‘They shouldn’t have gotten those homes,’ and they’ll blame those homeowners who lost their homes,” said Shanna Smith, the president of the National Fair Housing Alliance. “Our investigation is trying to help the people who didn’t lose their homes and live in that neighborhood and are struggling to build equity and pass on something to their children.”

Foreclosed homes in predominantly minority neighborhoods are six times more likely to have holes in the wall

National Fair Housing Alliance

Fannie Mae said in a statement that it strongly disagrees with the allegations and that its maintenance standards “are designed to ensure that all properties are tended to and treated equally.” A spokeswoman says the agency tries to use local maintenance contractors. It also said it now had a national policy that those contractors use glasslike material instead of plywood on broken windows and doors, eliminating the most visible sign of blight.

Fannie Mae said that a property should receive the same core maintenance regardless of the condition the home is in when the agency takes possession of it. It would not comment, though, on how much it spends on such foreclosure maintenance each year, citing the litigation.

The groups’ evidence comes from a yearslong investigation in which housing advocates visited Fannie-owned properties in 38 metropolitan areas. They looked at ZIP codes in both minority and predominantly white working- and middle-class communities with a high number of foreclosures. For each property, investigators assessed basic maintenance items, including whether the lawn had been tended, windows repaired and exterior holes fixed. They checked for damaged siding, unsecured doors and the for-sale signs that mean brokers are actively trying to market a home.

Foreclosed homes in predominantly minority neighborhoods are two times more likely to have broken mailboxes

National Fair Housing Alliance

Every property and every individual deficiency was photographed, creating a collection of nearly 50,000 images of the American foreclosure crisis, from Midwestern bungalows to California McMansions in widely varying condition. (Although Google Street View suggests that some of the homes visited several years ago have since come back to life, the groups were able to study only a small share of the foreclosed properties under Fannie Mae.)

In their database of properties, one-third of the foreclosed properties in census tracts that were at least 75 percent white had fewer than five problems. The same was true of just 9 percent of foreclosures in census tracts that were more than 75 percent nonwhite.

About a third of foreclosures in those heavily minority tracts had more than 10 problems. By contrast, just 7 percent of properties in heavily white areas had that many problems. Many individual issues — unsecured doors, boarded-up windows, overgrown shrubbery — were also significantly more common in the minority neighborhoods than in the white ones.

According to a regression analysis cited in the suit, differences in local crime levels, property values, sales dates, prices and other nonracial factors account for only about one-third of these disparities. The persistent pattern, the lawsuit claims, can be explained only by race.

Foreclosed homes in predominantly minority neighborhoods are five times more likely to have broken windows

National Fair Housing Alliance

The consistency of the finding nationwide suggests a problem baked into Fannie Mae itself, Ms. Smith said, and not limited to the behavior of individual contractors hired to do this maintenance work. A similar investigation did not find the same racial disparities among the smaller stock of foreclosures managed by Freddie Mac, another quasi-government lending agency.

“The simplicity of the investigation is that Fannie had the money, they paid contractors to do the work,” Ms. Smith said. “And Fannie utterly failed to implement quality-control measures to make sure that all of their foreclosures were being properly maintained.”

In Baton Rouge, La., Gloria Williams lives next door to property No. 8440 in the investigation’s database, a blue-and-white clapboard house that had what seemed to be a jungle out back and boarded-up windows when investigators visited it in 2014. Ms. Williams, 75, has lived on the block for 47 years, in a home where she raised her son and cared for her mother and has always made sure the lawn was mowed. Her census tract, as of 2010, was 98 percent black.