A D.C. SUperior Court judge, who last week upheld a tax on professionals who work in the District of Columbia, yesterday ordered the city to return as much as $7 million of the funds it has collected because some professionals had to pay the tax before others.

If the decision by Judge John Garrett Penn is upheld in the D.C. Court of Appeals, a process that could take as two years, thousands of doctors, architects and engineers will receive refunds.

Penn's action was based on a civil suit brought by two suburban lawyers against the city. The suit claimed that the tax itself was enacted illegally and that it discriminated against professionals who do not live in the city.

In his opinion last week, Penn dismissed the suits, finding that the imposition of the tax was within the power of the city government and was constitutional as applied to nonresident professionals.

Two days later, in a highly unusual move, Penn called attorneys on both sides of the case back into his courtroom to hear arguments about the constitutionality of the way in which the tax was phased into operation, beginning in January, 1975.

Attorneys for the suburban lawyers argued that the tax was unfair because some professionals had sto start paying the tax immediately, while others started to pay as late as December, 1975.This was because depending on when a firm opens for business, its fiscal year - or 12-month tax period - can be set at the month of its choice, pending approval of the Internal Revenue Service.

As a result, because of the way the District's tax statute was written, professionals whose tax year began earlier than others had to pay the city tax sooner.

The city argued that the tax was fair since all professionals were charged at the same rate.

Penn held that the way the tax originally was implemented was discriminatory because professionals were paying the tax at a variety of times. Moreover, he said, because of the phase-in process, some professionals paid the tax at a higher rate than others, which is discriminatory, the judge ruled.

Although he found the statute to be constitutionally defective, Penn then interpreted its language in such a way to keep the tax in effect but cure the statute of any "constitutional problems."

To do that, Penn had to interpret the statute in such a way that all the nonresident professionals who paid the tax would be liable for payments beginning at the same time and at the same rate.

So, in order to save the statues constitutionality, Penn concluded that the City Council intended to have the tax begin on Dec. 1, 1975, not Jan. 1, 1975.

"Any earlier date would raise serious questions since some taxpayers still would be subject to the tax before others" because of the time when their tax year began, Penn said.

As to the rates, Penn decided that all taxpayers should have paid at a rate of 12 per cent for December, 1975, and 9 per cent thereafter.

Tax payments are based on a formula that applies the 9 per cent rate to a pesrcentage of the professionals' incomes. It technically is called a unincorporated business franchise tax.

Specifically, Penn's order only applies to the parties to the two lawsuits, which included a class action on behalf of all nonresident taxpayers.

A city attorney said yesterday that if Penn's decision is upheld on appeal, the District would be compelled to give refunds to residents as well as nonresidents who paid the tax prior to December, 1975.