Ending months of negotiations, the tenants at McLean Gardens yesterday reached an agreement with builder Dwight W. Mize and with the present owners of the complex that will give tenants until Oct. 1 to purchase the project for $24.5 million.

"I'm overjoyed," said Jack Koczela, chairman of the McLean Gardens Residents Association, a group which has waged a nearly decade-long struggle to preserve their project as moderatelypriced housing.

"I'm looking forward to the next major step before us - closing on the property," Koczela said. The tenants who remain have "absolutely" every intention of making that settlement date, he added.

Yesterday's agreement requires that the tenants close on the purchase by October and pay a total of $2.15 million to Mize, a California builder who signed a contract more than a year ago to purchase the complex from Fairmac and convert it to condominiums.

But Mize later found himself in a fight with tenants over who had the right to purchase the 723-unit complex, for years one of Northwest Washington's largest concentrations of moderatelypriced rental housing. McLean Gardens is located in an area just northwest of the Washington Cathedral on 43-acres of grassy, gently sloping land.

The tenants claimed their right to purchase under a city law requiring owners to offer tenants the first right to purchase a property before it is sold to an outside developer.

Under the settlement agreement reached yesterday, Mize essentially is being paid more than $2 million to give up his claim to McLean Gardens. If the tenants don't close on the property by October, however, the agreement states that Mize then can buy the project himself as long as he settles by Dec. 31.

William P. McCulloch III, a World Bank lawyer who has renovated slum housing in Southeast Asia, has been one of the tenants' major financial backers. With McCulloch's aid, the moderate-income and elderly tenants at McLean Gardens raised a $500,000 deposit last December. They also have been involved in extensive negotiations with two major lenders to get financing to purchase the project - the First National Bank of Maryland and the Bank of America, based in San Francisco, according to McCulloch.

McCulloch said he will resign his World Bank job next month to become coordinator of the tenants' development project. He said a financial adviser and consultant also have been hired to help carry out the project.

In addition, the tenants have a commitment from the U.S. Department of Housing and Urban Development for subsidies for the occupants of 45 cooperative apartments. They also plan to use the profits from the sale of some condominiums at market rates to subsidize the prices of other units for lower-income families, Koczela said. Currently, only 162 of the complex's apartments are occupied.

Koczela said the tenants will have to come up with financing for a $17.5 million mortgage. The present owners will hold a $7 million deed of trust for the remainder of the purchase price, he said. When finished, which may take five years to complete, the entire project will have cost around $75 million, he added.

The tenants development plan calls for the rehabilitation of existing units to be operated as cooperatives or condominiums, plus the construction of townhouses and duplex apartments that will be sold to the public. The total number of units may be about 1,300, and will serve a wide range of incomes.