Japanese Prime Minister Yasuhiro Nakasone may have unwittingly let the genie out of the bottle in January when he began his meeting with President Reagan by talking about trade.

Instead of easing incipient trade frictions between the United States and Japan, as the Nakasone government intended, the meeting catapulted trade from its low-profile position within the Reagan administration and made it "the hot problem" in the relationship between the United States and its closest Pacific ally.

By calling attention to the $37 billion U.S. trade deficit with Japan, moreover, the Reagan-Nakasone summit spawned a tougher line on the part of the Reagan administration toward the trade problems with Japan and unleashed an explosion of anti-Japanese sentiment in Congress.

Nakasone, in fact, achieved what Walter Mondale and the Democrats were never able to do during the election: make trade a political issue.

What has occurred over the past three months is exactly the opposite of what Japan intended when it pushed for an early summit meeting so Reagan and Nakasone could reaffirm the close "Ron and Yasu" relationship.

Japan, brushing aside Reagan administration objections, wanted the two leaders to meet early, preferably before the president was inaugurated for his second term. They also wanted the meeting to take place in California, or possibly Hawaii, to symbolize the position of the two good friends on either edge of the Pacific Basin.

Although some Japanese made no secret of the fact that the real purpose of the visit was to defuse potential trade frictions, the bureaucrats surrounding Nakasone wanted to play down trade and focus on what they see as the larger strategic aspects of the relationship, which U.S. Ambassador Mike Mansfield calls the most important between any two nations in the world.

The night before the meeting, for example, a senior official in the Nakasone party predicted that trade would play a minor role in the talks, totally eclipsed by the strategic relationship. He said this would be true especially because Defense Secretary Caspar W. Weinberger would attend the meeting while neither of the top administration trade officials -- U.S. Trade Representative William E. Brock and Commerce Secretary Malcolm Baldrige -- nor their key aides had been invited to the California talks.

Little did he know.

Nakasone overruled his advisers, and, according to a senior U.S. official present at the talks, "the prime minister took the initiative in addressing the fact that we have serious trade problems."

Ironically, until preparations for the Nakasone visit began, trade had been a back-burner issue in the White House, laid to rest as a political problem in the Ohio Democratic primary when Gary Hart defeated the more protectionist-minded Mondale.

To the despair of trade experts in the U.S. government, no one at the upper levels of the administration focused attention after the election on the record trade deficit, which soared to $123.8 billion last year.

According to all accounts from Tokyo, the Japanese had trouble understanding this. A senior U.S. official with broad experience in Japanese affairs explained that the Japanese couldn't believe the Reagan administration would put up with such a massive trade deficit without lashing out at trading partners with protectionist moves. They knew, the expert continued, that Japan and the nations of Western Europe would react that way.

Two things changed the administration's attitude, according to sources.

First, "trade was playing too small a role, and reality finally caught up" as the trade deficit began to grow larger, one administration official said.

And at the same time, responsible business leaders hardened their attitudes on trade and began to communicate to top White House officials and Cabinet members their view that the United States needed to exhibit a new toughness in its dealings with trading partners, especially Japan. These were well-respected businessmen, who ran well-managed and highly competitive companies that still were shut out of foreign markets by unfair trade practices.

Even so, at the initial midlevel meetings to draft an administration position for the Nakasone talks, the Office of the U.S. Trade Representative and the Commerce Department stood almost alone in calling for a tough stance on trade.

But as Cabinet-level officials began to pay more attention to trade, the position changed, administration and Capitol Hill sources said.

"The chances are, if there had not been a Reagan-Nakasone visit, the only people who would have known about trade were the Commerce Department and USTR negotiators. There wouldn't have been weekly Cabinet meetings on the issue," said one congressional trade specialist.

The Reagan-Nakasone talks, moreover, raised the level of negotiations to the sub-Cabinet level, bringing to higher-level officials "the same frustration with the Japanese that negotiators in the trenches have felt for years," the congressional source said.

Attempts to smooth over the trade frictions foundered on the confluence of two key events taking place on the same date, April 1: the end of four years of so-called "voluntary" quotas on Japanese auto imports in the United States and publication of regulations for Japan's newly denationalized telecommunications network. These regulations are seen here as either allowing U.S. companies to crack the lucrative Japanese market or setting their exclusion in protectionist concrete.

With the April 1 deadline, the telecommunications issues became the focus of trade talks that arose from the Reagan-Nakasone talks; and reports of a lack of progress added fuel to the views of businessmen, Reagan administration officials and congressmen that Japan refuses to play fair on trade.

Even though the magnitude of the deficit had been widely predicted in advance, the publication of the 1984 trade figures had a major impact in Congress.

"The day it snapped with Sen. John C. Danforth (R-Mo.) was the day we got the trade figures," said an aide. "Where the overall deficit was not as bad as we had thought, the deficit with Japan was worse."

Danforth, who is chairman of the Senate Finance Committee's trade panel and helped the administration pare the worst protectionist features from last year's trade bill, lost his cool. He lashed out forcefully at Japanese trade practices and introduced a nonbinding resolution urging the president to retaliate. He also stunned the Japanese by refusing to meet with any more trade delegations, calling it a waste of time.

Shortly after the trade figures were published, President Reagan decided not to ask Japan to renew limits on its auto exports to the United States without exacting trade concessions in return.

That move, too, appeared to enrage Congress. Danforth accused the president of endangering a very important relationship by his inaction and accused the administration of having no trade policy.

Inexplicably, Japan fanned the flames even more by announcing that it was setting its own limits on car shipments to the United States -- an increase of 25 percent to about 2.3 million units a year.

The Japanese never knew what hit them. By all accounts, they thought they were making a concession to the United States by imposing limits when they believed their car sales could go even higher -- as high as 2.7 million units.

Instead of a polite "thank you," the White House went out of its way to criticize the Japanese action. A senior administration official said the 2.3 million figure was no concession at all. Spokesman Larry Speakes, meanwhile, emphasized that President Reagan was not looking for a deal when he declined to ask Japan to extend its quotas.

The Japanese were stunned. Despite major conciliation efforts -- that included mobilization of hordes of Japanese officials who had flocked to Washington to "take the temperature" of the Reagan administration -- Japan had badly misread the mood of Washington.

Both the House and the Senate overwhelmingly asked the president in nonbinding resolutions to take retaliatory actions against Japan -- one of the harshest moves Congress has made against a close ally.

For trade negotiators, these votes were tools to wring new, last-ditch concessions from Nakasone in the telecommunications talks.

For Japan and Nakasone, they spell big trouble. The prime minister, in a move that was seen here as politically risky for a man with only a shaky hold on the leadership of his party, gave the Japanese people a stark outline of what those measures could mean:

If enacted into law, he said, the bills could cause "a serious depression in Japan. Many people would be unemployed. Japan is now facing such dangerous times."

And as he contemplates the troubled future, Nakasone also may be pondering the wisdom of having pressed for an early meeting with his friend Ronald Reagan, and of quickly bringing up the contentious subject of trade. With Reagan's predilection for dealing in pleasant generalities over harsh realities, the president might have glossed over the unpleasant issue entirely.