Bad economic news turned out to be good news for the Treasury this week as concerns about a sagging economy spurred domestic investors to buy U.S. government bonds just as foreigners' enthusiasm for investing in the bonds has waned.

Defying widespread anxiety that pervaded markets in recent weeks, the Treasury's success in borrowing a record-breaking $66 billion in a single week and at the lowest rates in nearly a year, reflected the depth of demand for safe investments, especially during uncertain financial times.

"What you're witnessing now is a classic flight to quality," said Skip Shaw, head of the government bond department at the New York investment house Bear Stearns & Co. "People want high-quality assets."

Worries had been spreading prior to this week's record Treasury borrowing. Foreign investors, and Japanese investors in particular, have bought as much as 40 percent of the bonds sold by the Treasury in recent years. But, hard-pressed for cash by their own declining stock markets and driven by rising interest rates in their own countries, Japanese and other foreign investors have stayed home in greater numbers.

"The reason the market has been nervous about supply is that we have relied to a substantial degree on buying by foreign investors," said Charles Lieberman, managing director of Manufacturers Hanover Securities Corp. in New York. Lieberman estimates that foreigners are now buying less than 10 percent of recent Treasury offerings. "The success of the auction was a function of the willingness of domestic investors to buy domestic securities and fortuitously replace foreign investors," he said.

The number of people and institutions willing to buy Treasury bonds and notes is important because that is how the U.S. government raises money to cover the nation's deficit and roll over its debt. Strong investor interest in the securities means the government can pay lower interest rates to raise money. With foreign interest in the bonds waning, a future decline in domestic interest would put new upward pressure on rates.

Figures for 1989 give a glimpse in the range of investors who buy Treasury bonds and notes, according to Samuel D. Kahan, chief economist of Fuji Securities in Chicago.

Of the $300 billion in debt issued by the Treasury and other government agencies last year, a third was bought by individuals and personal trusts. Foreigners bought another 18 percent. Commercial banks bought 13 percent. Chunks of $10 billion to $20 billion also went to insurance companies, pension funds, state and local government retirement funds, and mutual and money market funds.

It is difficult to break down the latest auction exactly because many primary dealers have turned around and sold the bonds quickly to other investors.

But Shaw of Bear Stearns said there was an increase in purchases by pension funds, insurance companies and other U.S. institutions, but "certainly not the Japanese," he said.

"You always have to look at the context," added Kahan. Even though the Treasury was trying to raise an unprecedented amount of money, the economy's slide has been pointing people away from other areas. The big supply of Treasury bonds was "an opportunity," he said, not a problem.

"Everyone is expecting a significantly slowing economy, if not an out-and-out recession," Kahan said. "The debate is about whether the economy is dead in the water or slipping into recession."

At the same time, some economists believe that with the exception of oil and food price increases, the inflation rate has been relatively stable.

Those indicators lead investors to think that the Federal Reserve will cut interest rates in order to stimulate the economy. The central bank has already trimmed interest rates by a quarter of a point, and many observers expect it to cut federal fund rates again at its open market committee meeting next week.

Kahan said investors want to protect themselves against a resurgence of inflation to levels reached in the late 1970s. "The big thing for us is the inflation of the '70s, the same way people in the '50s talk about the Depression," he said.

DAY........TERM...........AMOUNT IN.....NEW......PREVIOUS.....DATE OF ..........................BILLIONS......YIELD......YIELD......PREVIOUS .................................................................YIELD

Monday...13-week bills....$9.8..........7.30%......7.35%.......10/29

.........26-week bills..... 9.8.........7.41 ......7.50........10/29

Tuesday...3-year notes.....12.6.........7.78.......8.10........ 8/12

Wednesday..10-year notes...11.0.........8.52........8.77........ 8/8

Thursday...30-year bonds...10.75........8.71........8.87......... 8/9

..........161-day bills....12.0.........7.41.........NA...........NA

NOTE: "NA" means not available.