A firm whose sludge disposal contract with the city was terminated earlier this year has been given another chance after developer Theodore R. Hagans Jr., a politically powerful friend of Mayor Marion Barry, signed on as its managing partner.

William B. Johnson, director of the city's Department of Environmental Services, said yesterday that the addition of Hagans to the roster of Dano Resource Recovery Inc. lends credibility to the efforts of the firm. Dano has tried and failed twice to secure financial backing to carry out its proposal.

The city has signed a $39 million contract with Dano to build a plant at the Blue Plains sewage treatment facility in far Southwest Washington where Dano would convert 900 tons of sludge a day into fertilizer. But that contract was terminated April 29 after the company failed to obtain financing to build the plant.

The year before, the city had signed a $20 million contract with Dano to build a similar plant somewhere else and convert sludge to fertilizer, but that contract lapsed as well before Dano could build a facility.

The city is under federal court order to find a way to dispose of the sludge from Blue Plains by Oct. 15. Johnson said the Dano firm has until July 27 to post a $1.5 million bond and show some financing commitments. If those conditions are fulfilled, the $39 million contract will be reinstated, Johnson said.

Johnson said he learned about three weeks ago that Hagans, a millionaire developer who was chairman of Barry's inaugural committee, had signed on with the Dano firm. Stalled talks with the company on renewing the contract were begun again, Johnson said, and last Friday the city agreed to reinstate the contract if Dano could show financial ability to get the job done.

"Ted Hagans is a person with a lot of credibility in the city," Johnson said. "That was important, with Ted bringing some local credibility to this thing and some financial viability."

Johnson said correspondence he has recently received from the firm lists Hagans as a managing partner. Neither Hagans nor other Dano officials could be reached for comment yesterday.

Under the contract, the city will pay the firm $24 a ton for the 900 tons of sludge a day the firm handles, plus $26 a ton for 800 tons of solid trash that the firm will mix with the sludge as part of its conversion process. But the firm gets no money until the material is actually hauled away from the plant, Johnson said.

The city has other options besides the contract with Dano to dispose of the sludge. But time is running out, and for a variety of reasons the Dano alternative seems increasingly attractive, Johnson said.

As a last resort, he said, the city could do its own sludge processing. But the likelihood of that choice seemed to diminish yesterday, as Mayor Marior Barry met with Rep. Stanford E. Parris (R-Va.) and agreed not to increase the amount of sludge the city sends to Lorton, which is located in Parris' congressional district.

Parris, an influential member of the House District Committee, had threatened to wage an all-out war against D.C. legislation on Capitol Hill unless the city agreed not to send composted sludge to Lorton.

Johnson said the city is also still negotiating with Steuart Environmental Systems, a firm that proposed shipping the sludge in ocean-going tankers to points south.

But Steuart has yet to come up with a workable alternative. The company first tried to negotiate an agreement to ship the sludge to Haiti, but Haitian officials killed the plan.

Then Steuart proposed shipping the material to the island of Antigua in the Caribbean, but officials there protested. Finally, Steuart settled on Colombia, but the country's health minister decreed last week that "under no circumstances" would the sludge be admitted.

The Washington Post reported four months ago that the city had spent nearly 40 percent of its housing acquisition funds over a two-year period to buy properties from Hagans, developer of the financially troubled Fort Lincoln new town in far Northeast Washington and a close friend of Mayor Barry. Officials denied that the transactions resulted from Hagans' friendship with the mayor or his political clout.

Mayoral spokeswoman Kathy Williams said of the Dano contract yesterday, "I can say with a great sense of security that it is not because of any friendship Ted Hagans has with the mayor," but rather because of the developer's local experience and financial track record.