A federal judge in Baltimore ruled yesterday that John Anthony Walker Jr., who is accused of selling secrets to the Soviets for thousands of dollars, cannot afford to pay his legal bills now because of a tax lien on his property.

But Walker, 47, who is now represented by two federal public defenders, will have to pay his attorneys' fees if funds become available to him, said Judge Alexander Harvey II. The judge made his decision after reviewing a financial statement listing Walker's assets and liabilities.

The Internal Revenue Service seized Walker's property earlier this month to satisfy a lien for about $250,000 in taxes, interest and penalties on unreported income since 1979, IRS officials said.

Walker, a retired Navy chief warrant officer from Norfolk, is one of four men charged with espionage in what has been described as one of the most serious spy cases in recent years. The other three men include his son, Michael Lance Walker; his older brother, Arthur James Walker, and his friend, Jerry Alfred Whitworth.

Prior to the IRS seizure, Walker had assets worth $239,253 and liabilities of $64,468, according to his financial statement. But a memorandum filed by his attorneys, Fred Warren Bennett and Thomas B. Mason, said the federal tax lien changes Walker's net worth from a positive $174,785 to a negative of $79,702.

Judge Harvey said the lien prevents Walker from selling or converting his assets to cover the legal expenses for private counsel in his case. As a result, Walker is entitled to public defenders. But if Walker successfully challenges the tax lien in a civil proceeding, as his accountant indicated he may try to do, he may then be required to pay his legal fees, the judge said.

Walker's assets, the financial statement said, include $1,150 in cash; stocks and bonds valued at $1,463; silver bars, $6,140; stamps and coins, $2,000; a 1980 Chrysler New Yorker, $3,000; a 1976 Grumman Tiger single-engine airplane, $20,000; a 1969 houseboat, $6,000; a 15-foot sailboat with trailer, $2,000, and household furnishings and effects, $2,500.

His real estate, the statement said, included his Norfolk residence, $70,000; the Norfolk waterfront lot where he has his houseboat, $60,000; four acres of land and a building in Ladson, S.C., $60,000; an unimproved lot in Colington Harbour, N.C., $5,000, and two unimproved lots in Great Exuma Island, Bahamas, which the statement said have a zero value because the property, unless developed, will be relinquished to the government of the Bahamas.

The statement listed these liabilities: $8,984 mortgage balance on the South Carolina property; $35,000 balance on the Norfolk residence; $4,074 balance on the Chrysler, and a $12,291 balance on the airplane. In addition, Walker has an outstanding balance on five credit cards: $1,553 on his Visa card, $1,551 on his Maryland National Bank card, $429 on MasterCard, $350 on American Express and $236 on a J.C. Penney charge card.

Walker's monthly income, the statement said, totaled $2,205 prior to his arrest. That included his $1,000 Navy retirement pension; $200 rental payment from the South Carolina building and $5 in dividends. Walker received about $1,000 from his detective agency each month, until his arrest, the statement said.