Warning that the Washington area faces a sewage sludge "emergency," a federal judge brushed aside protests by city officials and ordered the District of Columbia yesterday to build a sludge treatment plant at Blue Plains by Feb. 15.

Judge John Lewis Smith Jr., in a long-awaited order, gave the District government until then to construct the proposed sludge composting facility at the Southwest Washington site. If the District fails to take this hotly contested step, the judge warned, the Washington area faces the prospect of accumulating hundreds of tons of sewage sludge daily and having no place to dump it.

In his ruling, Judge Smith said the area's present sludge emergency "raises the possibility of a shutdown" of the Blue Plains waste water treatment plant, which handles the overwhelming portion of the Washington area's daily sewage output. Such a move, officials said yesterday, would leave the area with no apparent way to treat or dispose of its sewage.

District of Columbia officials, who have long opposed plans such as the one ordered yesterday, said they would consider challenging the ruling, either by seeking reconsideration in U.S. District Court or appealing to the U.S. Court of Appeals. City officials have contended that building a composting facility on a crash basis at Blue Plains would pose a health hazard to District residents.

Assistant D. C. Corporation Counsel Frederick F. Stiehl said yesterday that the plan ordered by Judge Smith would pose two potential air pollution hazards.

City official have determined, Stiehl said, that the proposed composting plant would emit excessive amounts of particulate matter - dust and other minuscule objects - into the air and that it would also help spread potentially hazardous spores of a fungus, called aspergillus fumigatus.

In an affidavit submitted to Judge Smith yesterday, John V. Brink, the city's air and water quality chief, said that the proposed composting facility "will cause violations at Blue Plains of the federally mandated air quality criteria for particulates established for the Washington metropolitan area as well as the requirements" of the 1977 amendments to the Clean Air Act.

The District's warnings of possible new air pollution as a result of the proposed composting operation have been met by skepticism by some other federal and regional officials.

Cynthia Puskar, an assistant Washington-area program officer for the U.S. Environmental Protection Agency, said yesterday that EPA officials had determined that the fungus spores would be "unlikely to cause health problems" if the composting facility were properly designed, operated and maintained. She said EPA had not yet evaluated the city's claims that a particulate air-pollution problem would result if the plant were constructed.

The Washington area's latest sludge battle is a significant issue in an area that has faced previous construction moratoriums because of inadequate sewage capacity. Many politicians are in the midst of election campaigns and sludge, the thick residue that is a byproduct of sewage treatment, is an unpopular item in many communities.

Judge Smith's order yesterday appeared to be a victory for Prince George's, Montgomery and Fairfax county officials who have argued that the District should be required to absorb its own sludge within city boundaries.

Washington officials have contended that it is difficult to dispose of sludge in an urban setting and have proposed instead to dump their sludge in city-controlled land at the Lorton complex in Fairfax County or a Muirkirk, near Beltsville, in Prince George's County.

The current sludge crisis stemmed partly from the city decision last May to abandon a previous plan to build a sludge composting facility at Oxon Cove near the southern tip of the city. The same fungus as has been cited now by city officials - aspergillus famigatus - was named as a potential health hazard that led to the collapse of the Oxon Cove proposal. The fungus, officials say, is often found. In composting material. Compost, produced from a mixture of sludge and wood chips, is used as a ground conditioner.

Soon the Washington area's sludge outlook began to assume crisis proportions. All the area's sludge produced at the Blue Plains treatment plant is currently being dumped at a Prince George's County tract near Cheltenham. This tract, however, is expected to be full by Sept. 21, officials have said.

In his ruling yesterday, Judge Smith appeared to accept a partial compromise proposed by Prince George's, Montgomery and Fairfax county officials and by the EPA. Under the plan, Prince George's County would agree to accept sludge from Blue Plains for a few additional weeks - until Dec. 3. Afterward, Montgomery County would receive the sludge until the new city composting plant at Blue Plains goes into operation next Feb. 15.

The judge's order left uncertain any long-term solution to the area's sludge difficulties. It specified only that Washington-area governments must take steps to dispose of sludge from the Blue Plains treatment plant in what was termed a "safe, environmentally acceptable manner" for a period of "at least one year" after the previously set Sept. 21 deadline.

"Even this is only a temporary solution," Assistant D.C. Corporation Counsel Stiehl said yesterday.

Under the judge's order, the new composting facility would be built on an eight-acre site at Blue Plains that was previously designated for a denitrification proposal, however, is being reexamined, city officials said yesterday.