A federal bankruptcy judge has cleared the way for tenants at a 12-building Southeast Washington apartment complex to purchase their apartments, ending a two-year struggle by the residents to own the property.

At a hearing on Wednesday, Judge Roger M. Whelan orally approved a bankruptcy reorganization for Butler Street Limited Partnership, which owns the 132-unit Finsbury Square Apartments at 1508-60 Butler St. A major partner in that group is the Haynes Management Co. Inc., which was founded and is run in part by James R. Haynes, former chairman of the D.C. Development Corporation, a quasi-public agency that finances housing and development.

The judge's oral ruling, which is expected to be made final next week, would allow the tenants to purchase the complex for $1.165 million. Haynes and his partners purchased the buildings in 1978 for $1.3 million and Haynes' company managed the complex.

In a telephone interview yesterday, Haynes declined to comment on details of the settlement. "I'll just say that we think it's good that the tenants have gotten the property," he said. "The tenants are in the best position (as owners) to manage it and we're happy for them."

According to court records that Haynes, a real estate lawyer, filed with the bankruptcy court, the owners owed a total of $1.14 million in mortgage debts to an insurance company and a former owner of the complex.

The partnership also owed a total of $216,413 in other debts, including more than $60,000 to Washington Gas Light Co. and an additional $156,000 to the D.C. government in unpaid water bills.

A settlement would end years of feuding between tenants, who have complained of deteriorating conditions at the complex, and the owners.

In 1980, the city's Rental Accommodations Office ordered Haynes and his partners to pay the tenants about $200,000 after they had collected increased rents between 1978 and 1980. That ruling is still under appeal, but the dispute would be settled as part of the proposed bankruptcy settlement.

The tenants also have been engaged in a rent strike since January 1981 and agreed to pay their rent first to the court and--after the bankruptcy was filed in June 1981--to the trustee. The rents were used by the trustee to pay operating expenses.

Two years ago, Haynes offered to sell the units to the tenants for $2.3 million. But in subsequent negotiations, a settlement was not reached. Negotiations with the trustee continued after the bankruptcy action began.

Under the plan approved by Whelan, the tenants association will purchase the units for an average price of $8,825, with the intention of converting the complex to a nonprofit cooperative. The tenants, who now pay from $200 to $280 a month, will continue to make comparable monthly payments to pay for operation of the property and to pay on mortgages.

Under the plan, filed by bankruptcy trustee Robert Tyler, the tenants would be able to receive approximately $16,000 which was deposited by them in the court registry while their suit against the owners, filed following the rent increases, was pending. Under the plan, that suit would be dismissed and the money used to pay the down payment and settlement costs.