At a time when official relations between Argentina and the United States are colder than they have been in years, this country's ties with the Soviet Union -- not always firm in the past -- appear to be growing stronger.

Two things happened simultaneously during recent weeks to bring about the present situation: a high point in what Argentina perceives as U.S. interference in this country's internal affairs, deriving from President Carter's human-rights policies, and a high point in Soviet efforts to polish its local image, mainly through scientific and cultural cooperation but later by bringing its military into the act.

In a dispatch to Moscow, reprinted in the press here, the local correspondent for the official Soviet news agency, Tass, wrote glowingly of "positive expectations in political and labor circles" and concluded:

"Events reveal the many-sided possibility of developing the relations between the two countries in spite of different economic, political and social systems."

U.S. relations with Argentina have been correct but far from friendly since the Carter administration took office in January 1977 -- at the height of what is called here "the dirty war" between Argentina's security force and several thousand terrorists and suspected leftist sympathizers.

The battles resulted in what this country's military authorities concede were "excesses" committed by counterinsurgency forces and what human rights activists say were "persistent, gross and aggravated" violations of human rights.

A low point in official relations between the two countries came not long after Carter's inauguration, when the United States announced that it would halt arms sales and other forms of military assistance to countires deemed to violate human rights, giving special mention to Argentina, Uruguay and Ethiopia.

Afterward, relations slowly thawed. Part of the reason was the improvement in respect for human rights here, but it was primarily because the U.S. human rights campaign was carried out vigorously but without fanfare or publicity by Ambassador Raul H. Castro.

Relations reached a peak two months ago after Argentina cast the key vote in the Organization of American States, assuring adoption of the U.S. stand opposing continuation of then president Anastasio Somoza's government in Nicaragua.

But the freeze set in again, becoming colder than ever, after an episode earlier this month on a question having nothing to do with human rights.

Under bold headlines, local newspapers for several days published dispatches from Washington saying that the Department of Defense had ordered U.S. ships and planes to challenge maritime nations claiming offshore jurisdiction beyond a three-mile limit. The articles said that Argentina, Burma and Libya, among the nations claiming more than three miles, had been selected for special challenges.

The State Department stepped in, explaining that the United States had simply restated its traditional insistence on a three-mile limit and intended no act of aggression against any country claiming more than that. But by then, there were new headlines -- this time on human rights.

State Department spokesman Tom Reston expressed the Carter administration's "surprise" at police raids on the offices of three human-rights organizations here. The raids had been ordered by an Argentine judge investigating possible perjury in the statements of persons petitioning the court for writs of habeas corpus on behalf of relatives missing since the 1978 military coup.

What the State Department did not know was that Argentina's military junta was also surprised at the judge's action and embarrassed by its timing.

The raids occurred less than a month before the scheduled arrival here, at the invitation of the junta, of the human-rights commission of the Organization of American States. The commission is to look into the cases of more than 5,000 missing persons and other matters.

However, officials and the press reacted strongly to the hope expressed in Reston's statement that "Argentina's authorities take no further action that could interfere with the activities of the commission."

Interior Minister Albano E. Harguindeguy accused the United States of meddling in the affairs of Argentina's judiciary. The English-language Buenos Aires Herald noted that "there was nothing at all illegitimate about the raids ordered by Judge Martin Ambzoategui" and accused the Carter administration of making "from-the-hip judgments on each and everything that happens here."

In another statement a few days later, Reston seemed to give currency to reports that "there might be clandestine prison facilities in Argentina where unacknowledged prisoners . . . might be held or even killed."

The State Department spokesman added: "We have asked our embassy in Buenos Aires to investigate. We have been unable to confirm or deny these reports. The government of Argentina has stated that there are no clandestine detention facilities in that country."

Publication of Reston's remarks provoked a general out cry here, Foreign Minister Carlos W. Pastor called Ambassador Castro to his office, and then met with President Jorge R. Videla to discuss the subject. An official statement by the Foreign Ministery said:

"The government knows its duties and responsibilities perfectly well and does not need the opinions or advice of foreign states for the conduct of its internal affairs."

Reston later said he regretted the "misunderstanding," but his remarks came very close to precipitating a serious breakdown in relations between the two countries, according to local sources close to the Foreign Ministry.

While all this was going on, the Soviet Union made amends for a "misunderstanding" involving the showing of a Swedish motion picture critical of Argentina at the 11th Moscow Film Festival. Responding to this country's protests, the Soviets apologized and said the picture would not be shown again, earning praise in newspapers here.

Even bigger headlines heralded an unprecedented visit to this country by a Soviet military mission, headed by Lt. Gen. Ivan Yakovich Braiko.

Braiko said on arrival that he hoped his delegation's visit would "promote the strengthening of the ties between our countries." He also spoke of "the fraternal and positive development" of ties between Soviet and Argentine military training establishments.

Braiko and three Soviet colonels who accompanied him were decorated by Argentina's army command, and Tass described the affair as "a transcendental event in the eyes of all observers."