A U.S. District Court judge here ruled yesterday that the federal government has not adequately enforced a law designed to remove hazardous lead-based paint from thousands of public housing units in the District of Columbia and around the country.

Judge Gerhard A. Gesell ordered federal housing officials to adopt new regulations to eliminate lead-based paint, a major cause of lead poisoning in children, from public housing units, saying the rules "should tilt in favor of safety rather than cost saving."

Interior paint containing large amounts of lead has not been on the market since Congress passed a law in 1971 restricting the amount of lead in paint. But, most of the District of Columbia's 9,000 public housing units for families were built before 1955, the year several paint companies voluntarily lowered the lead levels of their products.

Gesell's ruling came in a suit on behalf of a child who was hospitalized for lead poisoning in 1980 while living in the Stanton Dwellings project in Southeast Washington. Similar cases continue to be reported.

The Department of Housing and Urban Development sets the lead-paint removal policy for local public housing agencies, which actually do the work.

However, Gesell found that "HUD has failed to effectively monitor compliance with the regulations or to seek their enforcement."

"Specifically," Gesell said, "HUD has no procedure to determine if the D.C. Housing Department has inspected each unit of HUD-associated public housing before occupancy and eliminated immediate harzards" as required by the federal lead-based paint law.