The Internal Revenue Service has filed formal papers claiming that Bernard C. Welch, accused slayer of Dr. Michael Halberstam, and a female companion owe the government $24 million in unpaid taxes in connection with Welch's alleged role in hundreds of burglaries.

In tax liens filed in Fairfax County and Duluth, Minn., where Welch maintained a summer home, the IRS alleged that Welch owes the government $16.6 million in unpaid income and gift taxes from 1978 through 1980. The agency contended that the woman Welch lived with for four years, Linda Sue Hamilton, owes $7.6 million for the same period.

According to a federal official in Richmond, the tax cases are among the largest against an individual in Virginia history.

The tax actions are the latest in what has become a tangle of competing claims and lawsuits against Welch, who police say has been implicated in more than 200 burglaries since his arrest Dec. 5, the night of Halberstam's slaying.

Already claimed are hundreds of allegedly stolen items identified by area burglary victims who flocked to Fairfax County police headquarters in recent weeks to view an estimated $4 million in valuables seized by police from Welch's home in Great Falls, Va. Future ownership of those items may be clouded in cases where victims have been reimbursed by insurance companies.

Earlier this month, a Fairfax construction firm filed a lien against Hamilton claiming $9,000 in unpaid labor costs for renovations to the Great Falls residence. In addition, Virginia tax officials said yesterday they plan to file state tax claims against Welch. At least one burglary victim has filed a civil suit in federal court in Alexandria for $500,000 in damages against Welch.

Welch's attorney, Sol Rosen, said yesterday that Welch "has no money to pay it [the tax assessments]. The IRS will have its hands full collecting it."

A D.C. Superior Court judge last week declared Welch eligible for public funds to help cover some of his court costs after Rosen claimed that Welch was indigent. Welch has maintained that he has been unemployed for 10 years, and has no property, cash, or income source, according to court documents.

Albert J. Ahern, the attorney representing Hamilton, said the IRS assessments were "way out of line with any income that she could be charged."

Federal tax officials declined yesterday to discuss their actions. But former Internal Revenue Service commissioner Sheldon S. Cohen, now a Washington attorney, said, "The law is clear: a professional thief has income -- from thieving.The question of whether there are any assets after appropriate retribution is made is a question the IRS can't answer now. . . . The IRS is getting in line so it can protect the United States' interest. Welch has a right to litigate it."

The $16.6 million assessment against Welch included unpaid taxes, penalties and interest due amounting to $1.8 million for 1978, $2.2 million for 1979 and $4.2 million for 1980. The IRS terminated Welch's tax year early, on Dec. 24, a standard procedure when officials believe their opportunity to collect taxes may be in jeopardy.

Welch also was assessed federal gift taxes amounting to $900,000 for 1978, $3.3 million for 1979 and $4.2 million for 1980. A source said the agency believes that assets in Hamilton's name -- including the couple's residence in Virginia -- may have been derived from Welch's alleged criminal activity.

The income tax assessments against Hamilton included $1.6 million for 1978, $1.8 million for 1979 and $4.2 million for 1980. Informed sources said yesterday that the assessments against Hamilton were lower partly because she had filed returns and paid some federal income tax for 1978 and 1979. One source said Hamilton paid $232,000 in federal income taxes in 1979 alone.

Local officials in Minnesota said yesterday the IRS filed identical liens against Welch and Hamilton in St. Louis County, where Welch has used the name Norman Hamilton and maintained a posh Duluth summer home.

In Virginia, State Tax Commissioner William H. Forst said the state routinely pursues back income taxes in cases like Welch's, and estimated that the state's share would come close to $3 million. Forst said, however, that state tax officials are not optimistic about reclaiming the funds because of the federal revenue agency's prior claim.

"You've got to be philosophical about all of this," Forst said. "The important thing is that somebody gets it [the income tax revenues] and that nobody gets away with this kind of thing."

Welch is being held without bond at the D.C. Jail, while the Halberstam slaying and other alleged criminal activities by Welch are investigated by a D.C. Superior Court grand jury. The government last week granted Hamilton immunity from prosecution, possibly in return for her testimony against Welch. Hamilton has maintained consistently that she was unaware of Welch's alleged string of burglaries or the Halberstam slaying.

One informed source said yesterday the IRS might soon attempt to recover and sell at auction some of the approximately 3,000 lots of jewelry, silver and other valuables that have been tagged and catalogued as stolen property.

It was unclear yesterday what effect such a move would have on individual claims to the goods. George Kaveney, a representative of a national insurance trade group, said persons who have already been reimbursed for their losses must return the money if they wish to reclaim their belongings. The IRS assumes that many victims will keep the money, one official said, leaving the property available to be auctioned off.

The Fairfax County Police Department now requires citizens claiming property allegedly stolen by Welch to present a letter of release from their insurance company before they may recover the goods.