Internal Revenue Service managers had early warning of trouble with the new Sperry-Univac computer system that was at the heart of tax-system chaos this year.

Yet they chose it over a superior, though originally more expensive, Japanese system that likely would have eliminated at least some of the problems, according to the preliminary findings of congressional investigators.

Some of the problems:

*The Sperry computers failed or did poorly on several IRS tests, and a subsequent IRS management summary said agency officials knew in January 1984, months before installation, that the equipment did not have enough capacity for the enormous workload, according to the Government Accounting Office.

Sperry technicians used an unorthodox computer code to help their machines pass a 1981 operational test, investigators found, then changed the code's structure, making the computers less efficient.

*Equipment made by Hitachi, a technically superior rival bidder, performed very well on all the tests, according to the GAO, but the Sperry system was purchased.

IRS officials were following contract criteria based on guidelines from the General Services Administration and the Treasury Department, agency computer official Thomas Laycock said. "Eighty percent was based on cost, and 20 percent . . . on technical criteria," he said.

The Hitachi system cost $160 million, $57 million more than the Sperry system. But the Sperry eventually cost about $190 million, investigators said, because it had to be "patched" with additional computer units so its original capacity could be almost doubled.

"They've kept throwing hardware at the problem," an investigator said. "Now they're patching patches."

"I don't think it was a deliberate decision to underbuy," said an aide to J.J. (Jake) Pickle (D-Tex.), whose House Ways and Means subcommittee oversees the IRS. But officials "without real experience in hardware or software . . . were under a lot of pressure -- to 'buy American,' to move quickly and to do it under various budget restraints."

In 1978, Congress approved a 50 percent boost in computer power for the IRS, but essentially just for equipment replacement, not the total redesign IRS officials had sought since 1972, they said. The agency still was not allowed to "enhance" or use its computers in radically different ways.

The result, the new Sperry system, was intended to carry the agency "well into the 1990s," with upgrading after four years, according to the GAO. By then, it was hoped, a total redesign would be approved.

Instead, according to M. Eddie Heironimus, the agency's top computer official, requests for new bids are to be extended by next January. "That ultimately will mean a computer replacement, if you will, in time for the 1989 filing season," he said.

Because the contractor will have to "eat the cost" of programming changes for the next new system, Sperry is the only company likely to be able to bid effectively on the contract, "and they won't have to give the government any bargains," an investigator said.

*The IRS created a computer-programming nightmare. When managers decided to rewrite 1,500 programs, switching to a new computer language, 300 relatively new, inadequately trained workers were given the task.

Many of the programs were later found to be full of errors, and IRS officials discovered that they had underestimated by a factor of at least four or five the added computer capacity required by the new language. The agency started a crash campaign to rewrite the programs, leaving little time for testing them before the filing crunch.

"A combination of insufficient computer capacity and inefficient computer programs" meant the system needed more time than scheduled for consolidation and updating of master files, basic computer work that had been done on weekends, the GAO found.

The longer this took, the less time IRS employes had to use the computer to catch cheaters, resolve errors and perform other tasks. The backlog multiplied.

*The old computer equipment was not kept functioning as a backup system, which might have averted major problems. IRS officials said they did not have enough money to keep old and new systems running simultaneously.

Heironimus said he regrets that top IRS managers did not press more vigorously for a sophisticated new design, rather than accepting "ground rules" limiting them essentially to replacing old equipment.

"The upshot . . . is that once we installed the equipment . . . we still would have had a system that couldn't cope with the workload, even if everything had operated perfectly," he said.

*The IRS generally lacks a coherent, overall strategy for technology, according to investigators and others.

Because of IRS Commissioner Roscoe L. Egger Jr.'s stated determination to "bring the IRS out of the stone age in computers" and his managers' desire to "earn personal brownie points," numerous smaller computer systems proliferate throughout the agency, according to an IRS watcher familiar with the investigations, who did not wish to be identified.

These systems, separate from the troublesome Sperry, include optical scanning for tax information, management of auditing information and systems for resolving errors.

"Without an overall strategy, you're going to wind up with a bunch of computer systems at IRS that don't talk to each other," the IRS watcher said.

To succeed in a major overhaul and have a system in place by the mid-1990s, a proposal must be approved by Congress within the next few months because of the bureaucratic maze it is certain to encounter, officials said.

Most observers say any complete-redesign plan is certain to include features to which Congress has objected, most notably electronic linkage of all IRS computers so information from one region is instantly retrievable anywhere in the country. Strict safeguards would limit access to the information and protect taxpayers' rights, according to officials.

Among the IRS goals, its officials say, are replacement of paper returns with an electronic filing system for most taxpayers; electronic money transfers, with refunds credited directly to taxpayers' bank accounts within a week; replacement of the slow, tape-based computer system with advanced "random access" technology; and enhanced search-and-match capability for retrieving some of the more than $90 billion it says is currently lost because of cheating and delinquency.

Heironimus said the agency has not decided on a specific proposal for the new design. "We're going to ask for help from the industry," and the commissioner will select from their suggestions, Heironimus said.

This amounts to "buying a strategy from private industry," the veteran IRS watcher said.

The agency's technological muddle is not uncommon in government agencies, he added. "But, since the IRS depends so heavily on computers, you would think they would be in the forefront . . . . Somebody better start ringing the fire bell."

As long as the agency lacks a strategy, an investigator said, its performance will be largely a matter of luck, "like a bear hunt. Sometimes you eat the bear. Sometimes the bear eats you."