In their frustration over the swollen U.S. trade deficit, Washington officials in and out of Congress have been indulging in an unprecedented outburst of "bashing" Japan, which has an embarrassingly large trade surplus with the United States and with the rest of the world.

The reaction borders on near-hysteria, and focuses at the moment on the possibility of introducing a 20 percent surcharge on imports. In an econometric-model exercise financed by Motorola Inc., Nobel Laureate Lawrence Klein of the Wharton School of Finance, without advocating a surcharge, estimated that it would raise between $35 billion and $59 billion in revenue in its first year.

There are other questionable ideas being batted about: For example, it has been suggested that Europe and Japan could restrict their capital outflows in an effort to slow down the rush of investments into the dollar, or that the United States itself ought actually to tax the inflow of foreign investment.

But for the moment, the import surcharge is getting the most attention, because it looks like the most menancing weapon with which to confront Japan. It is being billed as a magic answer to our economic problems: At one stroke, it would bring down not only the trade and budget deficits, but curb the rise of the dollar in foreign exchange markets. On the latter point, you can get as many points of view as the number of economists you assemble. As many think an import surcharge would drive the dollar up as those who think the result would be the opposite.

With no pretense, it is aimed at Japan, but would have to be put into effect across the entire spectrum of imports, because to do otherwise would be a clear violation of international trade rules to which we have subscribed under GATT, the General Agreement on Tariffs and Trade.

But a surcharge is a very bad idea, a blunderbuss of a weapon designed to punish Japan for failing to buy more imported goods -- especially manufactured goods -- from the rest of the world.

"I think it's a rotten idea," admits Sen. Max Baucus (D-Mont.), who has been trying to get some of his constituents' high-quality beef into Japan. "But it may help our export industries.

Harvey Bale of the Special Trade Representative's Office -- which opposes an import surcharge -- said the other day at a Washington think-tank seminar on the subject that foreigners "would regard a surcharge as a confession of our inability to get the budget deficit under control, and the dollar therefore would take a tremendous plunge."

Moreover, it would attack national pride ("their manhood and womanhood") in Europe and Canada. "I'd give them about a week to retaliate," Bale said.

Nonetheless, an import surcharge may be triggered by one of two events: a Japanese failure by April 1 "to do the minimum required" to open their markets, as promised, to more telecommunications and high-tech equipment from America; or failure later on this year of the Common Market countries to agree to a new multilateral round of trade negotations that President Reagan wants participants to endorse at the economic summit in May in Bonn.

My feeling is that the administration is not too unhappy to see senators and congressmen popping off angrily against Japan: Whatever brings Japan to the negotiating table is worth doing, they say privately.

The betting in Washington is that the Japanese, having taken careful soundings of the hostile mood on both sides of the aisle in both houses of Congress, soon will make the concrete announcement on telecommunications and high-tech equipment imports necessary to defuse the import surcharge "surge."

This seems to be borne out by two straws in the wind this week: One of the most persistent critics of Japan's foot-dragging, Undersecretary of Commerce Lionel Olmer, hinted that Japanese negotiators are giving ground on the issue of telecommunications imports; and Japan now is ready to give 50-year copyright protection to American computer software, after arguing initially that 15 years of protection was adequate.

Actually, Japan has come a long way from the totally inward nation of the hundred years preceding World War II, and rarely gets credit here or in Europe for the degree to which it has opened its markets. In part, that is due to the Japanese insistence on gaining an internal consensus when it strikes out in a new direction: The process is slow, and Westerners have less patience than Orientals.

When two distinguished Japanese -- Sony Corp. boss Akio Morita and veteran economist and former diplomat Saburo Okita -- came to town two weeks ago to discuss the angry mood that has grown up in both countries, Sen. John Danforth (R-Mo.), a key congressional figure on trade matters, refused to see them. In fact, Danforth said he won't see any Japanese representatives until they take actions to open their markets.

In a long conversation with Post editors and reporters, Morita and Okita made clear they have gotten the message. They concede that NTT, the Japanse telephone monopoly, must knock down the barriers it has set up to competition. (Morita says that Sony, like many American companies, has been frustrated by NTT's locked doors.)

But Okita, the thoughtful elder statesman who is credited with having engineered the Japanese economic growth miracle of the 1960s, warns that results aren't going to look dramatic.

"We know that a conceptual change is necessary, there is need for a transition. It is not a question of unfairness in keeping imports out , but slowness of response . There is a historical difference that must be borne in mind. We have had to push exports for the past century. The whole structure was adjusted to push exports. That was our tradition," Okita said.

But such appeals fall on deaf ears in todays' Washington. Danforth and like-minded senators and congressmen feel that the Japanese have had plenty of time, and they are willing to use admittedly crude instruments such as the surcharge to knock the Japanese into submission.

Supported by the AFL-CIO, which is suffering from a steadily declining membership, some congressmen are losing their sense of proportion. For example, at the above-mentioned seminar, held under the auspices of the Institute for International Economics here, Sen. John Heinz (R-Pa.) said that rising Japanese exports "make people mad." If unchallenged, he said, "something sudden, dramatic and unstoppable will take place. So don't retaliate against the world, retaliate against Japan: They deserve it!"

Heinz's words chilled a good number of trade experts in the audience. The aggressive tone seemed more compatible with another era when, if other nations didn't do our bidding, we would resort to gunboat diplomacy, or worse. (Okita said in one conversation that the degree of hostility was what one might expect in a prewar atmosphere.)

In fact, the Japanese trade surplus has many causes, of which their barriers to imports of manufactured goods -- while significant -- form only one element. A major problem is the excessively high level of the dollar, which makes Japanese goods cheaper and American goods more expensive in world markets. Another problem -- for other countries -- is that Japan makes high-quality goods, and knows how to market them.

And finally, a large element of the unemployment in the United States that the AFL-CIO reflexively blames on Japanese competition is due to the fact that many corporations have shut down operations here and moved them abroad. In part, this has been a response to the fact that some unions have priced themselves out of the market.

A new Brookings Institution study shows that almost 15 percent of manufactured imports consist of U.S. components that have been assembled abroad. Offshore assembly -- at the moment, Mexico, Haiti and Colombia are the leaders -- means the loss of jobs for lower-skilled assembly jobs in the United States. This process is going to continue, and the Brookings report suggests that Congress should undertake a "large-scale investment in upgrading the U.S. work force."

That would be an intelligent response to the international reorganization of markets, especially for high-tech markets. The resort to protectionism, through import surcharges, quotas or other devices, is not.

But emotion, rather than reason, is in control in Washington today. The basic corrective for the trade deficit -- a significant reduction of the $200 billion budget deficit that would bring both interest rates and the dollar down -- looks to be out of reach. Those who push the surcharge have a more specific objective: Stick it to the Japanese.