The D.C. Court of Appeals ruled yesterday that the city must refund up to $58 million it has collected in taxes from 4,500 area professionals. The decision threatens to throw the District's now-shaky finances into even more disarray.

For a $50,000-a-year lawyer or other professional who has paid the tax annually since it was imposed in 1975, the refund would be as much as $7,500. About two-thirds of all the refund would go to suburban residents who conduct business in the city.

In a 9-to-1 decision, the full appeals court said the D.C. City Council, in adopting the tax, violated a provision of the congressionally granted Home Rule Charter that prohibits any form of commuter tax.

Judith W. Rogers, the city's chief legal officer, said there did not appear to be a basis for an appeal to the U.S. Supreme Court, the city's only remaining recourse.

If yesterday's decision becomes final, it means that up to $58 million the city has collected -- and has spent -- must be refunded to the original taxpayers with as much as $9 million additional in interest.

The ruling also means the city cannot collect about $12 million it was counting on to finance the current fiscal year's unbalanced budget.

That budget already is at least $28 million short of the money needed to keep the city running normally until the end of the fiscal year on Sept. 30. Department heads have been warned that they face spending cuts.

City officials from Mayor Marion Barry on down freely acknowledged yesterday that they did not know the ruling's full impact on municipal operations. Barry will meet with top officials at a previously scheduled 7:30 a.m. meeting today, with the tax crisis topping the agenda.

Barry said he may call upon the City Council to act swiftly to impose new taxes, including a possible gross receipts tax that would cover all the fees received by professionals for their services.The court ruling did not deal with any such possible tax.

John A. Wilson (D-Ward 2), chairman of the council's Finance and Revenue Committee, emerged from a hastily called informal meeting of council members to say that he would oppose any stopgap tax proposal. He called for reducing the city bureaucracy, which now totals about 47,000 employes.

Finance Director Carolyn L. Smith said the city expects eventually to reclaim as much as $18.8 million of the refunds through the D.C. personal income tax.

Under D.C. law, city residents who paid the professional tax have been allowed to take the bulk of the payment off their District personal income taxes. Smith said these taxpayers will be required to file amended income tax returns for the years affected and will owe the city some portion of the refunds.

That will not be the case for suburban residents, although they may have to report the refunds on their state and federal returns as regualr income.

The decision by the council in 1975 to let D.C. residents deduct the professional tax payments from their personal income tax returns was part of an acknowledged effort to get revenue from suburban residents while not increasing the burden on persons who live in the city. Barry was the council's finance chairman at the time.

Yesterday's court decision was based on a 1977 suit challenging the tax brought by two suburban lawyers -- Axel Felix Kleiboemer of Kensington and Richard A. Bishop of Alexandria. Both practice in the city.

A three-judge panel of the appeals court struck down the tax last April, but that decision's effect was held up when the city appealed, leading to yesterday's ruling.

Yesterday, professionals responded to the ruling with an array of feelings ranging from enthusaism to nonchallance. The tax affected smaller businesses more than larger firms that could absorb the tax better, a number of professionals said.

"Taxes like (the professional tax) are important in our business," said Robert Fisk of Fisk and Rosen, a law firm in the city. "The tax is not onerous, but it is substantial."

A dentist, who asked not to be identified, said, "I felt all along that it was a hardship that should not have been used against the professionals."

Pediatrician Daryle Z. Fowler, a District resident who paid $1,175 last year in professional taxes, said it was unfair that professionals in the District were paying more than those in other jurisdictions.

"Just like any other tax, it raised the cost of operating in the District," said Claude Engle, one of the partners of General Engineering, a city firm that paid about $3,000 in professional taxes last year.

"With the workmen's compensation in the District, which is about 2 1/2 times that of the neighboring jurisdictions, it's almost cheaper for people not to work here. The professional tax wasn't something that was going to break you. But with all the other taxes, the extra little things mount up."

The professional tax is levied at a 9.9 percent rate on 30 percent of each affected taxpayer's net income, after the expenses of maintaining an office and staff are deducted. The other 70 percent of the net income is regarded as the individual's salary and is not taxed.

For example, an architect receives fees totaling $250,000 a year, buy pays out $200,000 in expenses. He keeps $35,000 as personal salary and pays a tax of $1,485 on the remaining $15,000.

Phillip L. Kellogg, a lawyer for Kleiboemer, estimated that a professional earning a net income of $50,000 annually and who has paid the tax for five years would receive a total refund of $8,400 -- $7,500 plus about $900 in interest.

For city officials, clearly the overriding problem is finding the money to make refunds. Except for about $4 million made in quarterly payments on Jan. 15, all the money has been spent in the normal day-to-day operations of the city government, Budget Director Gladys Mack said yesterday.

The next problem is determing when the refund must be made. The court opinion was silent on that question.

Last week, at a City Council hearing on the city's budget problems, Mack speculated about the potential impact of an adverse ruling by the court if it came. She said that she was hopeful that the refunds could be put off until the new fiscal year begins Oct. 1, and perhaps that they could be strung out over a period of years. But Rogers, the D.C. legal chief, said yesterday she was "just not terribly optimistic about it [deferred payments] at this point."

The court said in its ruling that is was "limited to deciding the case before us," and would not speculate on whether the city could impose some other form of taxation -- such as a gross receipts tax -- to replace the lost revenue.

Such a tax presumably would be levied on the entire gross income of those conducting business activities in the city, whether or not they are city residents or suburbanites.

The court's majority opinion was written by Judge Cathrine B. Kelly, who wrote the original decision in April that first struck down the tax. Although the court has nine active members, it was joined in yesterday's unusual 9-to-1 decision by retired Judge Hubert B. Pair, who also had been a member of the panel that reached the original decision.

Judge Julia Cooper Mack dissented, contendin that "the reference to a commuter' tax only triggers an emotional response and obscures the issue," and that the city has a right to tax all of business income.