United Auto Workers President Douglas A. Fraser warned Japanese automakers last night that they will face stiff U.S. trade restrictions if they don't start building more of their cars in this country.

The warning aimed specifically at Toyota and Nissan Motors (the latter builds Datsun cars and trucks), was billed as a major policy shift in the union's once-firm stand in support of free trade.

Fraser sought to blunt the blow by saying his union still "believes the U.S. market needs the discipline of foreign competition."

But he said Toyota and Nissan have been behaving in an undisciplined manner by exceeding private export agreements made in 1977 and, generally, by trying to take advantage of a "short-term situation" in which U.S. plants are retooling to build smaller cars.

"Time and time again, the UAW put the Japanese automakers on notice," Fraser said here at the UAW's annual Community Action Program conference. "Ours efforts at diplomacy are over, and now we're going to take off the gloves."

In implementing the bare-knuckles approach, the UAW will propose legislation requiring foreign car manufacturers that sell more than 200,000 units annually in the United States to open assembly and parts plants in this country.

Under the proposed law, affected firms would be obligated to produce a "substantial amount" (as much as 80 percent in some cases) of their American-sold cars in the United States or face stiff export limitations.

"If Japanese auto firms want to continue to benefit from the American marketplace, they must contribute to it," Fraser said. "The best way for them to do so is to open assembly and parts plants here and produce the Toyotas and Datsuns and Hondas with American labor for the American market," he said.

Honda already has agreed to the UAW proposal. The company announced last Friday that it will begin turing out new Civic and Accord sub-compact autos at a new Ohio plant in 1982. That move will make Honda the second foreign auto manufacturer with a plant in the United States. German-based Volkswagenwerk AG has an American subsidiary that has been assembling Volkswagens in a plant in New Stanton, Pa., since the spring of 1978. About 78 percent of the 214,835 Volkswagen Rabbits sold in the U.S. last year were built in this country.

"The Japanese are not just exporting cars to the U.S. They are also exporting unemployment," Fraser said.

Vice President Walter F. Mondale also spoke at the UAW conference last night. In making an unabashed appeal for the union's political support this election year, he praised President Carter as "a progressive Democrat, in the finest tradition of the Democratic Party," who has looked after the welfare of the American worker.

In a warmly received speech, Mondale cited what he called the administration's favorable labor record -- putting 9 million more Americans to work since 1976, improving public service job programs and federal minimum wage compensation, and waging a hard-fought, but unsuccessful, battle for labor law reform.

A record 2.33 million imported cars were sold in the United States last year -- 22 percent of all U.S. car sales for 1979. Japanese automakers grabbed 76 percent of that import sales market.

Meanwhile, more than 200,000 UAW members have been on layoff as their companies struggle to catch up to the trend toward smaller cars, Fraser said.

He added: "Because the Japanese refuse to exercise restraint during this period, the time has come for us to force it upon them. Virtually every other country in the world limits the import share in some way, and so should we."

Fraser said a "reasonable lead-in time would have to be allowed" Japanese car makers before they are required to start producing in the United States a substantial number of the cars they sell here. In the interim, Congress should force Japanese automakers to stop flooding the U.S. market with their products, Fraser said.

The UAW president said his union has been pushing American automakers since 1948 to produce small, fuel-efficient cars to compete against foreign imports. "Now fuel-efficiency regulations and consumer damand are forcing them to develop plant capacity to do so," he said.