The United Auto Workers Union, with 300,000 of its members out of work, yesterday took the extraordinary step of asking the government to set quotas to cut by more than half the number of foreign cars and trucks imported.

In addition, the union asked the international Trade Commission to raise duties on imported cars from 2.9 percent to 20 percent of the wholesale price. The union asked the government to maintain its 25 percent import duty on trucks.

The protectionist action, which would be effective for five years, would give the auto industry time to retool and produce its own gas-efficient small cars to compete with the imports, the union claimed.

The one country that would not be affected by the petition for import protection is Canada, where the UAW has thousands of member's involved in the manufacture of cars and trucks for export to the United States.

General Motors Corp., Ford Motor Co. and the Chrysler Corp. had no immediate reaction to the UAW petition. But General Motors has historically opposed import restrictions, and Ford executives have said that any restraint should be voluntary. The UAW has also traditionally opposed protectionism, but slumping domestic sales and production have at least temporarily changed its mind.

The ITC has up to six months to make a recommendation to the White House for a final decision. Whoever is president at that time will then have two months to decide the case. If dissatisfied with that decision, the union can appeal to Congress.

"You add six (months) and two (months) and you're going to have a political decision at all," said an administration official, acknowledging that any decision would likely come after the November elections.

The UAW leadership has staunchly supported Sen. Edward M. Kennedy for president, but a union spokesman last night said the UAW hadn't yet given up on the current administration.

The administration has opposed any import restrictions, claiming they would raise prices for consumers, impede fuel conservation efforts and lead to retaliation by foreign trading partners.

For example, the importer of a Toyota Corolla Tercel two-door sedan with a dealer cost of $3,365 now pays an import duty of about $98. Under the UAW's proposal the duty would increase to $673.

The union's action is one of the most far-reaching cases ever filed under section 201 of the Trade Act of 1974, known as the escape clause, which provides temporary relief to industries injured by a substantial influx of imports. The purpose of the clause is to allow sufficient time for the industry to adjust to international competition.

The union must prove that it has been injured and that the injury was caused by a substantial number of imports, not just a few combined with mismanagements by U.S. automakers or other possible factors, a government official said.

The union contends that foreign car and truck manufacturers, particularly the Japanese, have taken advantage of the domestic automakers' inability to switch quickly to gas efficient cars. It said in its filing that five years of import relief are needed to complete the domestic industry's retooling program that began as early as 1973. The retooling will cost the industry about $80 billion between now and 1985.

"We believe there is strong evidence that substantial injury is occurring to the auto industry because of imports surging last month to 28.4 percent of new car sales compared to 17.6 percent in 1978," said union president Douglas A. Fraser.

The union is seeking to impose quotas based on import levels in 1976 or 1975 which the union said were normal years. In 1976, 1.7 million imported cars were sold here. In 1975 1.3 million were sold. A total of 8.5 million foreign and domestic cars were bought in 1975 and 10 million in 1976.

Imports for 1980 are projected to reach about 2.9 million, compared to total U.S. car sales of 10.6 million.

Import quotas would also apply to light trucks.