The Internal Revenue Service last year secretly overturned a 1976 ruling by an IRS district director and apparently granted the controversial Howard Hughes Medical Institute a long-sought status as a tax-exempt public medical research charity, according to tax records on file here.

The tax records, which were filed with the IRS late last year by the institute, show that the institute, the shadowy repository for part of the legendary Hughes fortune, now appears close to being formally declared tax exempt by the IRS.

The decision could free the Miami-based institute from up to $2 million in back taxes it would have to pay as a private foundation. In addition, as a taxable foundation the institute would have to pump $40 million or more into medical research and divest itself of half its lucrative stock holdings.

Since it was founded by Hughes in 1953, the institute has been the subject of unusual scrutiny by outsiders -- and equally intense secrecy by those on the inside. Skeptics have claimed it was an intricate tax dodge, and it has been the subject of a congressional inquiry. Reams of newsprint have been devoted to it -- institute officials routinely claim at least half the information is inaccurate but offer no corrections.Furthermore, Hughes himself once said he wanted all his money to go to the institute someday.

Hughes did give the institute all the stock in the Hughes Aircraft Co. when the institute was formed. Dividends from the stock still make up almost all of its income today.

Officially, the IRS says the institute's tax status is "undetermined," as it has been since passage of the 1969 federal Tax Reform Act. That act was designed to cut the misuse of private foundations as tax shelters.

Both the IRS and the institute refused requests recently by The Washington Post to discuss the institute's tax status further.

But tax returns filed by the institute late last September provide a glimpse into the long-running case, one of the most complex to come before the IRS in years, according to federal tax experts. The nearly $500,000 in legal fees paid by the institute to its tax lawyers here in the two most recent years that its tax returns have been filed seem to lend support to that claim.

In addition, the tax documents also provide a clue to another mystery that has puzzled the medical community recently -- why the institute's medical director broke a strict 25-year silence last month to reveal at least a partial picture of where Hughes' medical largess has gone.

According to the tax records, these events have taken place since the passage of the 1969 tax act:

In September 1970 the institute requested tax-exempt status under the 1969 act as a public medical research charity. That status was one which Hughes' interests had lobbied for diligently when the act was being written. Like a number of the other specific exemptions it was carefully tailored for just one organization -- in this case the Hughes Medical Institute.

A year later, the IRS replied that it still had no formal definition of what was a taxable foundation and what was tax exempt. Hughes' status, the IRS said, was therefore undetermined. It took the IRS six years to come up with its definition and meanwhile the Hughes institute unilaterally assumed a temporary tax-exempt status.

In February 1976 the IRS formally defined taxable private foundation status and tax-exempt public charity status. A month later the IRS district director in Jacksonville ruled in a little-noted decision that the Hughes institute did not qualify as a public medical research charity. The ruling was appealed to IRS headquarters here by Hughes.

Last year the IRS overruled its Jacksonville director. In a technical advice memorandum issued on the institute's appeal, the IRS said that before 1972 the institute was not directly involved in the conduct of medical research. Because of a steady growth in "medical research activities" by the institute since then, however, it now does apparently qualify for public charity status, according to the latest tax return filed by the institute.

An IRS official said that the memorandum would not be made available.

Tax records on file with the IRS also show that on March 27, 1973, the institute filed for a protective provision under the 1969 act which gave it retroactive temporary public charity status back to the begining of 1970 when the act took effect.

Delays by the IRS extended this temporary exemption until Feb. 13, 1976, when the IRS issued its final tax status regulations for foundations. It is unclear from the tax records available why that temporary status continues to the present, but the institute, in its 1977 tax return, filed as a self-declared public medical charity.

While the 1977 tax return filed by the institute notes that the IRS memorandum said the institute had "a steady and increasing growth in medical research activities" after the start of 1972, federal tax returns for the years from 1972 to 1976 do not show such an increase.

Before the 1976 Jacksonville ruling, according to the institute tax returns, the dividends from the stock holdings in the Hughes Aircraft Co. -- which made up virtually all of the institute's assets -- rose only from $2.5 million to $4.2 million.

During that time the institute and Howard Hughes came under fire in news stories and at a series of hearings held by a House Banking subcommittee. Critics charged that the institute was spending far less than required by federal tax law on medical research in order to qualify as a medical research foundation.

In 1976, the year of the Jacksonville ruling and perhaps not incidentally of Hughes' death, the amount of money made available to the institute nearly quadrupled to $15.7 million.

In an article in the New England Journal of Medicine last month, Dr. George W. Thorn, head of the institute's medical advisory board, gave an abbreviated history of the institute and its activities. While little news was revealed by Thorn, he did note that in 1976 the institute had undertaken a sharp increase in its medical outlay. He did not mention the IRS rulings.

According to the institute's tax return, it got about $18.2 million in Hughes Aircraft stock dividends in 1977. The return also shows a jump in medical research expenditures. But that figure -- $4.5 million -- still falls well below the 6-percent-of-asset requirement in the federal tax law for foundations.

The institute estimates the book value of its aircraft company asset at $214.5 million in its 1977 tax return. But it acknowledges that the resale value may be higher. Some observers have placed the real value at twice the tax return figure.

On the basis of these figures it is not clear why the IRS last year overruled its Jacksonville district director. It is also unclear whether the "steady and increasing growth" assessment referred to in the 1977 tax return came from the institute or the IRS technical advice memorandum.

An IRS spokesman said the tax service's regulations prohibit the disclosure of a particular tax investigation and he declined to say whether the technical advice memorandum had been issued.

"The only thing we are permitted to say," the spokesman said, "is that the institute's tax status is still undetermined."