The Soviet Union today pulled an abrupt about-face against its former ally, deposed Ugandan dictator Idi Amin, denouncing him and giving qualified support to the Tanzanian-backed invasion that toppled him.

The policy reversal was signaled in the Communist Party daily Pravda, which said Amin's rule had brought Uganda to the brink of financial ruin and that his secret police had operated unchecked "doing whatever they liked."

It was the first time in years that the Soviets officially had voiced criticism of Amin despite a deluge of reports that he had turned to butchery and repression to rule Uganda. Amin's armed forces got most of their equipment in recent years form the Soviet Union. A group of Soviet military advisers was sent to Uganda.

While falling short of outright endorsement of the invasion that toppled him two weeks ago, Pravda asserted that the new Tanzanian-backed government of President Yusufu Lule has promised to restore law and democratic rights in Uganda.

The turnaround fits with the longstanding Soviet practice of backing winners in the Third World no matter what ideological contortions may be required.

The abruptness of the change is illustrated by the fact that the latest issues of New Times, the foreign affairs weekly widely distributed in various languages in Africa, voiced regret at Amin's ouster.

New Times said of Amin's government that it "did not always find rational solutions to social and economic problems, often committed serious administrative errors and did not take into account the interests of all groups of the population."

Yet, the weekly declared that it was "regrettable" that "two neighboring African countries . . . should have found themselves involved in . . . fratricidal war."

While New Times columnist Boris Asoyan blamed a Western boycott and the war for Uganda's economic problems, Prava today openly asserted that Amin himself had fumbled economic reform.

"The economy of the country not only did not develop, but fell into decay," Pravda asserted.

The move by Pravda effectively realigns Moscow's public stance on Uganda, bringing it closer to its justification of tis own involvement in the Vietnamese invasion of Cambodia early this year that toppled the Peking-backed regime of Pol Pot. Pravda fell far short of endorsing the Tanzanain-backed invasion, but its polite bow to Amin's successor government tacitly lays the ground work for taking a similar line in future public descriptions of the conflict - that Tanzania, like Vietnam-backed insrugents in Cambodia - were moved to act because of a repressive regime.

The Kremlin's relationship with Amin has been somewhat cool for several years, although Moscow counted him among its African allies. In Novermber 1975, Moscow abruptly suspended diplomatic ties with Kampala after Amin denounced Soviet policies in Angola and blocked off the Soviet Embassy.

Diplomatic sources report here that late last year, the Kremlin tgnored Amin's pleas for new weapons to fight off the invasion and early this year the last Soviet advisers are said to have been flown out of Uganda.