The Soviet Union, smarting silently from its own recent diplomatic reversals at the hands of Ayatollah Ruhollah Khomeini, is treating the takover of the U.S. Embassy in Tehran as both a propaganda windfall and an opporunity to bolster Kremlin influence with Iran.

The official Soviet media has carried daily dispatches from Washington and Tehran describing the crisis in ambiguous terms that imply support for the seizure last week of the embassy and about 60 Americans.

At the same time, Soviet Persian language broadcasts to Iran justify the attempt to force U.S. turnover of the shah to revolutionary justice on the grounds that the United States uses the embassy to spy on the Khomeini government and plot is downfail.

However, Soviet ambassador Oleg A. Troyanovsky said yesterday before the U.N. Security Council meeting that diplomatic immunity from force or takeovers should be "adhered to strictly and in all cases in all countries." The Soviets voted for the council's plea that the U.S. diplomats be released immediately.

Although Washington has portested the Persian-language broadcasts as inflammatory, the Soviets have shown no sign of ending them. Today, the official Tass news agency concerntrated on the movement of U.S. naval units in the Persian Gulf area, broadly hinting that Washington would use the embassy takeover as a pretext for military action to overthrow Khomeini.

[A Defense Department spokesman said there were 13 U.S. Navy ships in the gulf, which were being deployed normally.]

The most blunt anti-American appeals have come from a powerful Soviet transmitter in Baku, the Casplan Sea oil port near the Iranian border. This "National Voice of Iran," which the Soviets maintain, is not an official government-sponsored station. In recent days it has called the U.S. Embassy in Tehran a "center of corruption and anti-Iranian conspiracies," and denounced the United States in harsh terms for allowing the deposed shah to receive medical treatment in New York for cancer.

Meanwhile, Moscow Radio's world service in recent Persian-language broadcasts has arrested that the embassy takeover and seizing of American hostages are "totally understandable and logical" since the chancery is filed with "agents of the CIA [and] . . . U.S. imperialists who have not ceased their imperialism against Iran."

The propaganda attacks came against a background of continuing frustration and minimal success for the Soviets in dealing with Khomeini. Last week, when Iran abrogated its 1959 treaty of friendship with the United States, it also broke two clauses of 1921 Iranian-Soviet treaty that allowed military intervention by the Soviet Union if its vital interests were threatened by events in Iran.

The abrogation of the Soviet-Iranian treaty clauses is a major blow to Moscow. The Soviets over the years have cited the treaty as historic proof of the Kremlin's interest in constructive ties with immediate neighbors. The treaty had been used internally to justify Kremlin cooperation with the pro-Western, anticommunist shah, as well as to explain Moscow's repeated attempts to achieve good relations with the sucessor fundamentalist Islamic government run by Khomeini.

The treaty was a basis for Soviet leader Leonid Brezhnev last November to issue his unilateral warning to the United States against military intervention on behalf of the shah to preserve the monarchy. Brezhnev called the upheavals then an internal matter for Iran, but said any U.S. direct action would involve Soviet vital interests.

The official Soviet media has so far failed to handle the newest difficulty of the abrogated clauses. In part this may be explained by the fact that the government has been on a long holiday to mark the 62nd anniversary of the Nov. 7 Bolshevik revolution.

The Soviets have made persistent attempts to curry favor with Khomeini at the expense of the United States since the shah was ousted. Yet in the embassy takeover, the Soviets find themselves caught in an inconsistency with their own insistence on diplomatic protocol and legality in state-to-state relations.Even before yesterday's U.N. statement, Moskovskaya Pravda, the capital's Communist Party newspaper, had headlined a Tass dispatch about the takeover as "legitimate demand," while the main newspapers headlined the same dispatch innocuously as "situation in Tehran."

The two-sided approach seems to reflect an inability to come to grips satisfactory with Khomeini. Although Iran along since resumed pumping natural gas to the Soviet Union, where it is crucial for industry and home heating in the Caucasus, Tehran has suspended construction of another similar gas line.

Soviet media generally have found good things to say about the ayatollah's reign, but two months ago, influential commentator Alexander Bovin, writing in the government newspaper Izvestia, abruptly labeled the revolution a disaster that has brought over chaos political persecution and fanatical repression of national minorities to Iran.

It was the sharpest Soviet attack on Khomeini and was thought by Western analysts here to reflect the views of the Kremlin's policymakers and to be a Soviet retort to pugnacious Iranian denunciations of communism and Soviet power.

The themes touched upon by Bovin have not been expanded on since or even repeated in any authoritative way.