The United States urged the Soviet Union twice during the tense period of strikes in Poland to be restrained in both attitude and action toward its communist neighbor, it has been learned.

An official in the State Department confirmed Wednesday that the appeal was relayed by U.S. officials to Soviet officials in both Moscow and Washington in two undisclosed meetings.

The official said that the Americans refrained from any threatening language and instead emphasized in diplpmatic terms the importance of allowing the Poles to resolve the situation without outside interference from either the Soviet Union or the United States.

Implicit in the U.S. messages, however, was the warning that serious consequences could follow any Soviet invasion of Poland or any other, overt pressure to end the confrontation between Polish workers and the communist government in Warsaw.

The Carter administration took the position that Soviet-American relations would be damaged by any such move far more than they have been by the Soviet invasion of Afghanistan and that Moscow's relations with Western Europe as well as Eastern Europe would suffer as well.

Although U.S. officials were concerned -- and to some extent still are -- about a possible Soviet invaision to crush the Polish strikes or to end reforms won by the workers the proaches to Moscow were not prompted by Soviet troop movements toward Poland, the department official said.

He refused to say what specifically prompted the U.S. appeals but apparently two visits by the Polish ambassador Romuald Spasowski, to Deputy Secretary of State Warren M. Christopher played an important role.