Just 2 1/2 months after they thought they had won their battle to buy their homes, the tenants of the Kenesaw Building appear closer than ever now to losing the once elegant apartment house at 16th and Irving streets NW.

After a trial that lasted most of the day, Judge Charles R. Richey of the U.S. District Court in Washington ruled yesterday that a contract between the building's owner, Antioch University, and the Nemac Development Corp. of Providence, R.I., is binding.

Unless the decision is successfully appealed, Antioch must now either sell the building to Nemac for $900,000 or risk paying damages for breach of contract. Nemac's lawyers have said that the least amount of damages they would sustain by such a breach is $1 million.

The issue of which course to follow has not been decided by Antioch's attorneys, who have found themselves in the curious position of arguing against the obvious economic interests of the university.

The tenants of the Kenesaw, which has about 80 units and houses 30 lower-income families, had originally agreed to buy the building for $750,000 from Antioch last January with the help of the District of Columbia Development Corporation.

There were several postponements of the settlement, however, as financing was being arranged for the purchase. In March, Antioch agreed to further delays, but reserved the right to accept other offers until June 1.

Nemac, a corporation formed by the Woloohojian Realty Co. in Rhode Island specifically for this purpose, offered $825,000 for the building on May 23. That offer was matched by the development corporation under the terms of its agreement with Antioch. Nemac then offered $900,000.

The figure could not be matched, and Antioch's attorney, Nathan Wasser, who was then also acting as its real estate agent with a 10 percent commission on any sale price over $800,000 signed the contract with Nemac's lawyer May 30.

On June 3, however, tenants of the Kenesaw flew to Antioch's main campus in Ohio and met with the university's trustees.

Five days after that meeting, Antioch President William M. Birenbaum announced at a press conference here that the university, in accordance with its longstanding tradition of social conscience and responsibility, would forego the $75,000 difference in the bids and "sell Kenesaw to the representatives of the tenants."

The decision was hailed by Mayor Walter Washington as "a dream come true" in the fight against speculators.

The ruling yesterday, however, determined that Birenbaum had no legal right to make such a commitment.