During the past five years, nearly $800 billion in foreign capital has washed across the United States, buying up companies, banks, luxury hotels and retail chains, building new factories, fattening bank accounts and financing a major portion of the national debt. That inflow ranks among the great financial transformations of the post-war era, and has helped turn the United States from the world's largest creditor nation into its largest debtor.

In most cases, Americans have welcomed foreign investors with open arms. State governors court them with special deals on taxes, land and, in some cases, schooling for their children. Federal officials laud them for keeping interest rates down and fostering world economic efficiency. Wall Street brokers fight for their commissions, workers for the jobs they create. And people with something to sell love the top dollar the foreigners offer.

But gradually, some Americans are starting to ask the same questions that arise in every country where noncitizens are allowed to park money: Is foreign investment in big quantities good or bad? In the long run, does it strengthen technology and management or promote economic subjugation? Does it mean sovereignty is being transferred abroad? Should it be limited in volume and by industry? As happens so often, the debate hinges as much on national pride as on economic fact.

"We face many of the same issues, in muted form, that Third World countries have traditionally faced," suggested Paul Krugman, a Massachusetts Institute of Technology professor. He termed the net effect positive, but predicted that foreign ownership in America will nonetheless emerge as a burning political issue in the early 1990s.

"We have a tremendous national adjustment facing us in terms of our self-image," Krugman said. "For pretty much half a century, we have been the world's supreme economic and technological leader, and the fact is we aren't anymore. We're now roughly on a level with the Western Europeans and the Japanese -- better in a few things, worse in a few things."

Rumblings of protest have been heard from a variety of quarters, though objectors are apparently still in the minority. Congress is considering a bill to tighten disclosure requirements for foreigners. A few business sages are talking about a need for controls on acquisitions of key U.S. companies. And in popular culture, resentment is surfacing, particularly aimed at the Japanese. In an episode of the television series "St. Elsewhere" last fall, a Japanese company bought the venerable community hospital and planned to knock it down, leading the characters to stage a sit-in on the front steps.

Through its history, the United States has generally allowed capital to flow freely across borders. European money, in particular British, played a key role in building railroads, mines, canals and factories in the 19th century. Since World War II, as the world economy has moved toward greater integration, foreign companies have been opening production plants here to be near customers, to get in on the United States' vast economic resources and to avoid import barriers. U.S. bank accounts and government securities have been seen as a money haven immune to world strife.

But in the 1980s, the flow has accelerated dramatically. There are many reasons: The United States has lost ground competitively in industry after industry and foreign companies are coming in to replace them. Persistent trade deficits have put billions of dollars into the hands of foreigners. Since 1985, the dollar has nose-dived, making the nation seem like a giant bargain basement to people holding currencies like the Japanese yen and West German mark. To them, buying American now costs half of what it did in 1985.

Despite its current economic woes, the United States still seems to be a good bet to the rest of the world. "When you go down to the {foreign} businessman," said Herman A. Vonhof, president of Dutch Institutional Holding Co., the U.S. arm of a Dutch pension plan that has $1.3 billion invested in real estate in this country, "he's very optimistic, very positive about the United States, and would like to be part of it."

Some economists have warned that if the dollar continues to decline, the foreigners might pull back, worried that assets they buy now will be worth less in their own currencies when they sell and convert out of dollars. So far, that fear seems unfounded. The flow has continued unabated.

No one knows precisely how much money has come in. But at the end of 1982, Commerce Department statistics show, foreigners held assets of $688 billion in the United States, including stocks and bonds, wholly owned companies, real estate, bank deposits and others. As of the end of September last year, that figure had more than doubled, reaching about $1.475 trillion. U.S. assets abroad declined in the same period, rendering the nation a net debtor in world accounts.

The growth is fast. But in absolute terms, foreign ownership in this country is small -- about 5 percent to 6 percent of America's total assets, federal officials estimate.

The Japanese buying spree has attracted by far the most attention, with about $31 billion of capital entering in the first nine months of 1987 alone. The Japanese play a major role in financing U.S. budget deficits, at times snapping up a third of new bond issues at U.S. Treasury auctions. (Overall, foreigners are estimated to hold about 10 percent of the national debt.)

Real estate is another Japanese favorite. Many of the high-rise hotels lining Waikiki Beach are Japanese-owned. The central business districts of Los Angeles, New York, Washington and other major U.S. cities are studded with glass office towers that have changed hands in the past few years. Citibank, the largest U.S. bank, last year sold about half of its Manhattan headquarters complex to Japanese investors for $670 million. The year before, Exxon Corp., the world's largest oil company, let go of its 54-floor flagship building for $610 million.

The Japanese are major-league players in the U.S. corporate and financial world, too. In 1987 Sony Corp. closed a deal to buy RCA Records, the largest recording company in the world, for $2 billion. Now Japan's Bridgestone Corp. has agreed to pay about $1 billion to take over most of the tire assets of Firestone Tire and Rubber Co., the second-largest U.S. tire producer. And the Bank of Tokyo, acting through a U.S. subsidiary, has agreed in principle to pay $750 million for California's Union Bank.

In other cases, the Japanese start from scratch. Most of their major automobile and electronics companies have long since opened plants in this country or have announced plans to do so. Today, second-tier companies, in particular auto-parts suppliers, are coming across the Pacific as well, spurred by the drastic fall of the dollar. "Small, nonbrand-name companies, formerly unknown, are now so wealthy that they are coming over looking for acquisition targets," said Martin Anderson, senior consultant at The MAC Group, a Massachusetts management consulting firm.

Few Americans realize it, but Europeans are far bigger and have been established as investors a longer time than the Japanese. European investors held $745 billion in assets of all kinds as of September 1987, compared to the $187 billion total for the Japanese. Unlike the Japanese, who prefer to operate quietly, Europeans have in some cases built their holdings through aggressive takeovers. Britain's Sir Gordon White, chairman of Hanson Industries, is a leader in this field. Among other things, his huge portfolio now includes SCM Corp., maker of Smith Corona typewriters. BAT Industries, another British conglomerate, is attempting to acquire Farmers Group Inc., a major U.S. insurance company, for $4.2 billion.

Canadians, too, are major players in the U.S. investment field, outstripping the Japanese until several years ago. In recent days, the financial pages have been full of stories on attempts by Toronto-based Campeau Corp. to buy Federated Department Stores, owner of the Bloomingdale's and I. Magnin chains, for almost $6 billion. In 1986, Campeau paid $3.5 billion for Allied Stores Corp., which operates the Brooks Brothers clothing stores and others.

The result is that today many "American" brands no longer are. Carnation is now owned by the Nestle group of Switzerland. Standard Oil of Ohio belongs to British Petroleum of the United Kingdom. General Electric's television and videocassette-recorder division belongs to the state-owned Thomson electronics group of France.

The Europeans also manufacture under their own names here. Volkswagen has been building cars at a Pennsylvania plant for a decade, although it now plans to sell the plant. The Swiss pharmaceutical giant Hoffman-La Roche makes drugs in the United States. European retailers such as the Laura Ashley and Benneton chains have opened outlets in this country.

The Europeans are also bullish on U.S. real estate. Dutch Institutional Holding Co., for instance, put up all the financing for the Market Square complex that is being built on Pennsylvania Avenue in Washington. It owns the 1,500-acre Grand Cyprus resort near Disney World in Orlando, Fla. It recently settled plans to build a $290 million tower in Atlanta that will change the skyline of the city.

In short, citizens from almost every country of the world have money here in one form or another. A South Korean company makes color television sets in New Jersey. Canadian interests operate the Brooks Brothers clothing stores. A Mexican investor owns United Press International. (Ironically, investors from the Organization of Petroleum Exporting Countries, much talked about in the 1970s as likely to buy out the United States, have slipped into relative obscurity in recent years, due mainly to declining oil revenue.)

Each time a foreign company announces plans to open a plant in the United States, a contest erupts among state governments to woo that firm. Company delegations travel as guests of honor from statehouse to statehouse, getting at each stop offers of incentives. In many cases, the visitors are not strangers -- the state's governor will have visited the investors' home country.

Foreigners may find that federal regulators say no when they want to buy into broadcasting companies and defense contractors. But otherwise, they are welcomed: U.S. law and government policy make no distinction between foreigners and Americans. Anyone who has the money can play the investment game.

The Reagan administration, and probably the majority of U.S. economists today, argue that this is how things ought to be. "This is in everybody's interests, just as trade is in everybody's interests," said Robert Ortner, undersecretary for economic affairs at the Commerce Department. The world is in the process of integration, and the United States should not stand in the way, Ortner said. Freedom of investment promotes efficiency in allocation of capital among the industrial nations, the economists said, noting that the United States is an investor abroad, with about $1.039 trillion in foreign assets as of the end of September.

In one sense, the proponents said, foreign investment here is a natural and unavoidable byproduct of a trade deficit. The United States' foreign partners are piling up dollars and have to do something with them.

There are practical, dollars-and-cents considerations, too. "We get the production, we get the jobs," argues Ortner. "And for that matter, we are beginning to get the exports resulting from that production. Who would have thought we'd be exporting cars to Japan?" he asks, referring to announcements by Japanese companies that they will export some of their U.S.-made cars to Japan.

Proponents contend that foreign companies bring new processes, technology and management techniques that, in the long run, will be learned by American employees and will help revitalize economic sectors that have fallen into disrepair. General Motors Corp., for instance, entered into a joint production venture with Toyota in part to learn how the Japanese make cars so well. In any case, proponents said, in the event of a spat with foreign powers, their assets are safe here in the United States -- owners can't pick up a building or factory and take it home.

Still, ripples of opposition are starting to be felt in this country, and the opposition often focuses on the Japanese. Last year, the computer giant Fujitsu Ltd. was about to acquire Fairchild Semiconductor Corp., a major U.S. producer of computer chips and a pioneer in that field. But at the last minute, the Pentagon stepped in with objections about foreign control of a company that has major defense work. The deal was scuttled, but many people wondered if the real issue was national security or national pride.

Consumer advocate Ralph Nader recently got into the act with a complaint about rents being charged by foreigners who own office buildings in Washington. Foreign landlords were raising prices so fast, he said, that some public interest groups were being forced out of the market.

Congress has yet to act, but it may. Last year, Rep. John Bryant (D-Tex.) introduced a measure to require disclosure of foreign holdings in this country in far greater detail than is now the case. By a vote of 230 to 190, it was included in a House version of a general trade bill. But the Senate, facing heavy lobbying from the administration and from foreign investors, failed to include it in its version of the bill and the matter is to be settled in a conference of the two houses.

There are other voices too. Malcolm S. Forbes, editor in chief of Forbes magazine, in January called for creation of a "Board of Knowledgeables" to review purchases of major U.S. companies by foreigners. Financier Felix G. Rohatyn, a partner in the investment firm Lazard Freres & Co., recently said the United States may have to consider such reviews. He noted that the decline of the dollar meant that Sony's bid for RCA Records cost it only half in yen what it would have cost before the dollar headed down in 1985.

Critics say foreign investment doesn't really create that many new jobs. While some of it opens new factories, most goes to take over existing jobs at American companies or banks, to increase foreigners' bank accounts or to finance the federal debt. Today's foreign money is different from what arrived in the 19th century, they note -- that was focused on long-term productive enterprises, such as railroads, not on day-to-day financing of expenses.

Most every country in the world regulates foreigners' role in their economies, Bryant pointed out, in the belief that ultimately they do not have the national interest at heart. (Japan, for instance, while hosting billions of dollar of foreign investment, sees the giant telecommunications company Nippon Telegraph & Telephone Corp. as a crucial national asset and bars foreigners from owning a single share in it.)

The skeptics wonder whether investors will really impart that much useful technology. Might they instead drain away the best the United States has? Might they send this country just the menial jobs that they don't want? In an extreme case, they worry, the United States may find itself open to economic blackmail. What would happen, they ask, if the Japanese yanked their money out of New York to make a point during trade negotiations?

Many critics blame current U.S. economic policy as much as anything, saying that this nation needs to put its own house in order to be more export-oriented and competitive. Others said outright controls are needed in the meantime to hold the line.

Foreign investors, meanwhile, appear to recognize that resentment could become a problem. Some are responding by operating in secrecy; others are stepping up efforts to get their point of view across. In January, for instance, foreign owners of U.S. real estate formed an association that counts among its goal to "educate the U.S. public on the contribution of foreign investment to the American economy."

Still others are trying their hand at some preemptive philanthropy. Shuwa Investment Co., one of the largest Japanese holders of real estate in this country and new owner of the U.S. News and World Report building in Washington, last month donated $100,000 to the D.C. government for a scholarship fund.