When Prime Minister Masayoshi Ohira first planned his state visit to the United States, he and his aides looked forward to a gentlemanly, polite exchange of views about lofty world issues with President Carter and American congreemen.

The last thing they wanted was another harsh argument over a grubby trade issue and now they fear that is exactly what will happen when Ohira arrives Monday.

In the worst-case scenario, which now seems to be inevitable, Ohira will face a barrage of congressional criticsm about Japan's trade surpluses and quire possible a bit of lecturing from Carter on the same subject.

In the past week, Japanese official had been unusually blunt in telling Americans that the current argument over governemtn imports is the most serious trade conflict in years. They insist that Japan has made its "best offer" to settle it and accuse the Americans of obstinacy. They think it has escalated out of control and fear that the United States, in one official's phrase, intends to "punish" japan for imagined sins.

Japan and the United States have been feuding about trade in everything from oranges to television sets for a decade and one well-placed official was asked recently to explain why this one seems especially serious to the Japanese.

What is different now, he replied, is that Japanese "feel accused of being immoral. That is our perception of the latest attacks in the United States - that Japan is doing something evil that must be rooted out."

It seems a prosaic issue to arouse such emotions. Washington wants Japan's public corporations to open their doors so that foreign firms can bid on about $7.5 billion worth of equipment annually. The Japanese, after first refusing, have now offered to permit foreign bidding on nearly $7 billion and U.S. special trade representative Robert Strauss says that is not enough.

The sticking point is Japan's insistence on exempting from foreign bids about $600 million worth of sophisticated equipment bought annually by Nippon Telephone and telegraph (NTT) from local suppliers.

During protracted negotiations, Japan gave ground grdually but refused to concede the last $600 million worth of telephone equipment, according to reliable sources, and Ohira said there would be "no more compromises."

In Japan's eyes, the relatively small money issue has escalated gradually into a major diplomatic conflict because the Americans chose to make the NTT issue a dramatic symbol of a Japanese market closed to foreign imports.

Ohira told a news conference yesterdya that although the percentage of government purchases involved is small the American Congress seems to be taking the issue as a symbol of the "closed market" and therefore it cannot be taken lightly.

He urged a "cooling-off period" before more negotiations are begun. He said he preferred not to discuss the issue in Washington, but acknowledged that if the American side raises it he cannot refuse to talk about it.

The issue has acquired symbolic importance, American sources say, because it is test of the Japanese government's willingness to take a political ricsk and compel its semi-public corporations to buy abroad. They question whether Japan will take strong action to open segments of the private market to imports if it cannot move those public companies over which it has direct control.

Ohira's advisers, looking beyond the NTT impasse, also view the long-range course of American trade politics with dismay. Their Washington lobbyists tell them protectionism is rising in Congress this spring. Several officials here foresee and anti-Japan issue springing up in the 1980 presidential election. They note that John Connally, a Republican aspirant, is making Japan's "closed market" a campagin issue and fear that Carter will be forced into a "get-tough-on-Japan" posture in response.

Despite the anxiety of his officials, Ohira has attempted to play down the trade controversy. In a recent interview he acknowledged that current economic relations with the United States were "rather unhealthy" but said he did not regard specific trade differences as abnormal.

"I don't think the situation is all that serious," he said.

All nations maintain some nontariff barriers that limit foregin imports, he said, adding, "This kind of barrier exists in every country and I don't think Japan is being a particularly bad boy."

But Ohira is caught in an unusual political crossfire at home over the NTT issue. He is accused on the one hand of having conceded too much to U.S. negoitators and on the other of having mishandled the negotiations by not anticipating what the Americans really wanted all along. His aides have responded in some cases by blaming the United States, insisting that the real American demands were not revealed until too late to formulate a compromise that could have eased Ohira's visit to Washington.

Their chagrin at the prospet of a noisy, argumentative summit meeting is genuine president is one of the most important political events for a Japanese prime minister. Tokyo is heavily dependent on Washington not only for trade but for military support. An ability to handle the U.S.-Japanese relationship smoothly is regarded here as a rupreme test of a prime minister's skills.

Ohira will arrive in Washington on Monday and hold discussions at the White House Wednesday. He will also meet during the week with members of the House and Senate and speak at the National Press Club. CAPTION: Picture, Ohira: "Better to eliminate one wrong than to initiate one right." UPI