Syria is expected to sign a security treaty with the Soviet Union this week that Moscow has been trying to press on the Syrian government for nearly a decade, according to authoritative diplomatic sources here.

Syrian President Hafez Assad is scheduled to start a visit to Moscow on Wednesday, and the treaty is set for signature during the visit, the sources said.

This symbolically important breakthrough in Syria's relations with the Soviet Union comes at a delicate moment for the Kremlin as it attempts to balance its conflicting interests in warring Iran and Iraq, Syria's immediate neighbor and arch-rival in the Arab world.

Syria, which traditionally has had good relations with Iran in part because they had common interests against Iraq, is the Arab country that has remained the friendliest to Tehran during the war at the head of the Persian Gulf. From the Soviet viewpoint, a treaty with Syria may also serve as a reminder to Iraq not to forget who its friends have been.

Iraq already has a friendship treaty with the Soviet Union under which the Iraqis have received the bulk of their arsenal.

"Instead of being called a friendship treaty, our treaty with Iraq should maybe just be called a technical assistance treaty," said one Russian, who noted that the Iraqi government only follows those clauses that are in Baghdad's interest. The Soviet source noted that the Iraqis have been making great efforts to diversify their relationships, not only by turning to France, but also to Italy, Yugoslavia, West Germany and others.

Despite the extreme delicacy of the Soviet attempt to be allied with both Iraq and Syria, attentive Western observers do not think that the Soviets will wind up having to choose between the two countries.

Both Syria and Iraq have an interest in preserving their links with the Soviets and, because of Washington's pro-Israel policy, neither is in a position to turn to the United States as its alternative superpower patron. This contrasts with the situation in the Horn of Africa, where the Soviets had to sacrifice an alliance with Somalia to conclude a new alliance with its rival Ethiopia.

Western analysts say they think Assad is drawing symbolically closer to Moscow to counteract the widespread impression inside the country that the hard-pressed Syrian regime is isolated in the Arab world. Syrian diplomats reportedly tell Americans that they are convinced that the Camp David peace agreement between Israel and Egypt was really an effort to isolate Damascus.

Similar motivations, the analysts say, explain why Assad leaped to accept Libyan leader Muammar Qaddafi's recent offer of a union despite the long history of failure of such arrangements.

The Syrian-Soviet treaty may wind up having no more substance than the limited expectations Westerners have of the Libyan-Syrian union, the analysts suggest.

Assad's willingness to sign now with Moscow may also be a measure of renewed confidence in his own position in Syria. Earlier this year, when he was fighting almost open rebellion by the conservative Moslem Brotherhood, there were a number of attempted and successful assassinations of Soviet officers in Syria. Since then, outside observers credit Assad with having repressed his opposition and consolidating his hold on power.

The expected treaty with Syria and other Soviet moves in the past few days seem to indicate that, after a period of watchful inactivity, the Kremlin has decided that it can afford to resume cautious probing for opportunities in the region.

The Iranian government said that on Saturday, the Soviet ambassador in Tehran had offered Iran military aid and was turned down. Since the only aid that would have immediate effect is spare parts and munitions for units already trained to use certain types of weapons, it is assumed that the Soviets were simply offering logistical support for Iran's relatively small contingent of Soviet-made tanks.

French officials, who are watching the weapons situation closely because France is a big arms supplier to Iraq, said today that they thought the Soviet offer to Iran was merely an attempt to display evenhandedness because Moscow is already or is about to resume supplying military spare parts to Baghdad.

Western diplomats here say they assume that the treaty with Syria will be looser than similar pacts, such as the one under which the Soviet Union justified its intervention in Afghanistan.