Japan looks enviously at the way Canada has piled up a huge trade surplus with the United States while adroitly dodging the blows of protectionists in the U.S. Congress. And, as Japan searches for some middle role in world diplomacy, its envoys recall admiringly how Canada acted as a bridge-builder after World War II.

Canadians, who enthusiastically repay the compliments, welcomed Japanese Prime Minister Yasuhiro Nakasone today for a three-day state visit.

Still suffering from high unemployment and the effects of the last recession, Canada casts longing looks at Japan's wealth and technological acumen and is eagerly pursuing expanded trade and joint investments with the Japanese.

Prime Minister Brian Mulroney wasted no time making his pitch that Canada can be the gateway for Japan into North America as he welcomed Nakasone.

Mulroney and Nakasone discussed nuclear arms and issued a statement opposing terrorism in general terms, but their talks on these matters are considered secondary to such issues as trade.

Canada and Japan are the United States' two largest trading partners. Japan's $35 billion trade surplus with the United States is followed by Canada's $20 billion surplus.

Despite the amicable relationship the two leaders have developed at state funerals and summits, there is still a cloud dating back to World War II, when Canada herded virtually all 22,000 Japanese here into internment camps. Debate here continues over the proper apology and compensation of former internees, although senior Mulroney aides, calling it a "domestic issue," said last week that Mulroney does not intend to bring the matter up with Nakasone.

There are other strains. "It's very difficult to do business with the Japanese," said a Canadian oil industry official. "They like to play the international market game."

Japanese are not sold on the idea of large-scale investments and high-tech joint ventures with the Canadians. They look somewhat disapprovingly at the Canadian labor force, which rivals Italy in frequency of strikes and labor disputes, and they say they find Canadian businessmen lacking dynamism.

"The Canadian is too accustomed to the easy export, the easy sale to the United States," Kiyoaki Kikuchi, Japan's ambassador to Canada said in an interview last year with the Toronto Star.

"It's very simple if you Canadians want to sell more," he continued. "You need more salesmanship, more export drive."

The Japanese have attempted to dampen Canadian hopes for making any big deals during Nakasone's visit, and in Tokyo they have tended to describe it as primarily a courtesy call before the May economic summit of major industrialized countries.

Nakasone sought assurances from Mulroney that the planned U.S.-Canada trade talks are not designed to create a "Fortress North America" fencing out Japan and other Asian countries. Senior Canadian officials said that Mulroney responded strongly that that was not the intention of the forthcoming talks.

It is not clear that the Reagan administration, facing intense pressures over the U.S. trade deficit, is ready at this time to roll out a red carpet for Nakasone, as the Canadians did when the Japanese prime minister arrived at the King Edward Hotel here.

Japanese Foreign Minister Shintaro Abe met with Secretary of State George P. Shultz in Washington late last week to settle a contentious dispute over Japan's high tariffs on forest products, then came here to rendezvous with Nakasone.

The Japanese prime minister is to speak Monday to the Canadian Parliament in Ottawa and travel the next day to Vancouver, where about half of the 40,000 Canadian citizens of Japanese origin live.

In an interview last week with reporters for the Japan Economic Journal, Mulroney extended a "wide open" invitation to Japan to invest in Canada.

"I want to convey, and will again, to Prime Minister Nakasone -- I told him this in New York, in Bonn and in Moscow -- bring your money, bring your yen, come to Canada; it is the place to be."

The Japanese reporters, like their diplomats, were more fascinated, however, with the cordial relationship between Mulroney and President Reagan.

Reporter: "Prime Minister, you are very well known for staying in close relationship with President Reagan. So we would be very appreciative if you could reveal a little bit about how the 'hot line' has been working . . . "

Mulroney: "Because you ask, I could tell you that President Reagan is going to be calling me this afternoon in an hour to discuss a major issue between our countries. I cite that by way of illustration. When matters come up between us, we pick up the phone and call one another."

Mulroney, however, was evasive when the Japanese reporters queried whether he might be interested in the concept of a "trilateral trade zone" including Japan, the United States and Canada. Senior Canadian officials said Nakasone made no mention of any desire for such an arrangement in the meeting with Mulroney today.

But, a senior Japanese diplomat in Ottawa, observing the chummy first-name relationship of "Ron" and "Brian," said wistfully that it would be pleasant if that were expanded to become "Ron, Brian and Yasuhiro."

Shortly before Nakasone left for the trip here, a U.S. Senate delegation in Tokyo, led by John C. Danforth (R-Mo.), not only pressed for more trade concessions but told the Japanese they must join the world. Japan has benefited from the world trading system and now must give something back, Danforth told them.

This is an area in which the Japanese look to the Canadians for help. They remember how the late Lester Pearson, architect of postwar Canadian foreign policy, defined a role for his country and won a Nobel Peace Prize for his efforts.

The Japanese have been saying that they would like to use Nakasone's visit to widen and elevate the relationship between the two middle-level powers.

"Just as they want us to change our view of Canada as a drawer of water and hewer of wood," a Japanese diplomat said on the eve of the state visit, "we'd like them to change their view of us as only a seller of Sonys and Hondas."