Secretary of State George P. Shultz, opening a 10-day trip to Europe, warned France's new right-wing government today that the United States is willing "to fight it out" over pending restrictions on U.S. grain markets in Europe.

Topping Shultz's agenda with President Francois Mitterrand and new Prime Minister Jacques Chirac, according to a senior U.S. official who was present, was U.S. concern over tariffs and quotas announced March 1 by the European Community. The measures threaten $1 billion in annual U.S. grain sales to Spain and Portugal.

"If we can't find a way to handle it, we're going to have to fight it out" with new U.S. tariffs on European goods, the official quoted Shultz as saying.

The trade restrictions, which are not yet in effect, are part of the conditions under which Spain and Portugal agreed on Jan. 1 to join the Common Market. Although the extent of the threat to U.S. sales is not yet certain, it comes at a time of increasing pressure on the Reagan administration to deal with a depressed farm economy at home.

The three leaders agreed that the EC rules will be a "very difficult and contentious issue" in forthcoming trade talks, the official said.

Shultz also brought up possible cooperation against international terrorism and in furthering arms control during his separate sessions with the two French leaders and found "no differences between them" on those issues, the official said.

Mitterrand, a Socialist, is expected to have major differences over domestic economic policies with Chirac, whose right-wing coalition won parliamentary elections here on March 16.

The most potentially divisive issue, the question of French participation in research for Reagan's Strategic Defense Initiative, did not come up in the talks with Chirac and was mentioned only in passing by Mitterrand, the official said.

Earlier, Shultz told reporters that he expects eventually to overcome congressional resistance to aiding rebels in Nicaragua.

Shultz also said he plans to press Greek Prime Minister Andreas Papandreou in Athens next week on the future of U.S. military bases in Greece.