W. Allen Wallis, undersecretary of state for economic affairs, called on the Japanese government Thursday to work toward reducing Japan's massive trade surplus with the United States.

A spokesman for the Japanese Foreign Ministry told reporters that Mr. Wallis stressed during regular high-level bilateral consultations in Tokyo that Japan should adopt new policies designed to speed improvement in the trade imbalance.Japan racked up a $59.8 billion trade surplus with the United States in merchandise trade last year, the Commerce Department said.

The spokesman said Mr. Wallis also asked the government of Prime Minister Noboru Takeshita to stimulate the economy if the growth rate slows during the last six months of this year.

The consultations, held in the Japanese Foreign Ministry, covered a broad range of issues, not just problems in bilateral trading, the spokesman said.

He went on to emphasize that the U.S. team led by Mr. Wallis was told that the country's external trade is undergoing a dramatic change stemming from continuous efforts to further open the economy to U.S. and other foreign goods.

He said the U.S. visitors were advised that Japan's overall trade surplus decreased from $89.7 billion during the fiscal year ending March 31, 1997, to $78 billion in the 12-month period that concluded last month.

Deputy Foreign Minister Hiroshi Kitamura, the head of the Japanese delegation to the consultations, was quoted by the spokesman as telling the U.S. team that cooperation of Washington and Tokyo is indispensable for proper development of the global economy.

In return, Mr. Wallis was reported to have praised the Japanese government for expanding the nation's economy through the engine of domestic demand instead of relying so strongly on exports as in the past.

The U.S. delegation, however, urged the Japanese to adopt immediate measures to comply with recommendations by the General Agreement on Tariffs and Trade, the group in Geneva regulating most world trade, to have Japan remove import restrictions on 10 agricultural products.

GATT made the recommendations following an appeal filed by the Reagan administration complaining that Japan was violating the organization's rules. Japan has said it is willing to lift the import curbs on eight of the 10 products.

The Japanese, for their part, repeated their concern about the omnibus trade bill now moving through the U.S. Congress. They also requested that Washington lift the remaining punitive tariffs imposed on certain electronic products manufactured in Japan in response to the violation of the 1986 bilateral semiconductor agreement.