For Alex Roesell, the judge's ruling in his favor wasn't exactly a storybook ending to his three-year case, for although he won the battle, he may have lost the war.

Roesell owns Globe Bookshops Inc., which operates its main outlet at 17th and G Streets NW opposite the Federal Home Loan Bank Board building.

One of the federal agency's commercial tenants is Crown Books Corp., a discount outfit. When Roesell discovered that the bank board had rented space to Crown at $7.75 a square foot for five years--about half the open market rate--he sued the government. He charged that the bank board was not authorized to make such a contract.

This week U.S. District Court Judge Oliver Gasch ruled that the bank board's lease with Crown Books was null and void and ordered the FHLBB to give its tenant a 90-day written notice of that. The judge said the agency then could "solicit bids on the space from Globe, Crown, or any other interested parties." But he also gave the board the option of "renegotiating a lease with Crown at the higher rates commanded by statute."

A spokesman said yesterday the bank board has not yet decided whether to appeal the decision or to reopen negotiations. Crown Books officials did not return phone calls yesterday.

But for Roesell the book case is closed. "I can no longer afford" to bid for the space "because of the losses I've suffered," he said. "I'm grateful that I've been vindicated. But I've received a crippling blow and I may have to go out of business."

Roesell, who has been in the book trade for 20 years, pays $20 a square foot at his location. The main store accounts for 50 percent of sales of his outlets.

Profits at Globe have been way down since Crown moved in across the street, Roesell said. He's tried to compete with the discount house by specializing in foreign language and international relations tomes. Last year he managed to break even, but he expects a loss this year.

Crown Books is owned partly by Dart Drug. Its discount operations have been wreaking havoc on independent bookstores in the Washington area.

When the FHLBB made its contract with Crown in 1978, the retail area of its new building at 1700 G street was doing poorly. It agreed to lease space to Crown for $7.75 a square foot for the first five years and $11.62 a foot during the next five years. It also agreed to take 4 percent of gross receipts over $1 million a year.

The base rent for Crown was only $28,800 instead of an estimated fair rental of $36,850 to $47,400 a year. But the bank board figured a share of the profits would bring its return up to the fair rental level.

Globe sued on the grounds that only the General Services Administration had the power to negotiate long-term leases on federal property. Judge Gasch ruled that the GSA could delegate the power to the bank board, but the board had not followed GSA standards in charging fair market rates. Gasch found the board's move "arbitrary, capricious and an abuse of discretion," and so ordered the contract terminated.