The Soviet Union appears to have been caught unawares by the violent power struggle in South Yemen. The fact that the man who may have emerged as the new South Yemeni leader, Abdal Fattah Ismail, is a hard-line Marxist who formerly sought refuge in Moscow is of little comfort, for the time being at least. The episode seemed to point up intelligence failures on the part of Moscow, and underlined its impotence in a conflict between rival Marxist factions of the country's ruling party.

The Soviet Union tried to intervene diplomatically after fighting broke out Jan. 13, but failed. It had to evacuate several hundred Soviets from the South Yemeni capital of Aden over the weekend. At press time yesterday, the warring factions reportedly were discussing a cease-fire, even as each claimed on radio broadcasts to be in control of the country, the Associated Press said.

Although the Soviets may eventually gain slightly greater influence in the country as a result of the coup, they have been badly shaken by the experience, according to some Kremlin-watchers here.

``They didn't know what was going on,'' was the pithy summation of one Western diplomat.

Worse, from Moscow's point of view, is the message that the incident sends to other Arab states. South Yemen is the closest approximation of a communist state in the entire Mideast. Moscow, at one time, saw it as a model with which to woo other skeptical Arab countries.

The incident also dents the image of this country's intelligence arms, the Soviet secret police (the KGB) and Soviet military intelligence agency. Neither can muster many excuses for failing to foresee and head off the conflict, since both operated with relative freedom in South Yemen. The Soviets kept thousands of troops, military advisers, and diplomats in the country.

Yet when fighting came, it was with a swiftness and savagery that seems to have stunned Moscow. Tanks and heavy artillery were used, and entire sections of Aden were reportedly leveled or gutted by fire.

South Yemen was backward and poor when it won independence from Britain in 1967. It set off on a firmly pro-Moscow course, severing diplomatic relations with the United States in 1969.

Hoped-for Soviet aid did not materialize in amounts sufficient to offset growing poverty in the country. Yet the Soviets did take maximum military advantage of the country, situated as it is astride the entrance to the Red Sea and near sea lanes leading to the Persian Gulf.

Meanwhile, President Ali Nasir Muhammad Hasani was reportedly growing disenchanted with the meager fruits of his courtship of Moscow. He was apparently steadily downplaying the two countries' links in order to attract Western investment. In 1982, there was reportedly an assassination attempt against him in by pro-Moscow hard-liners. Thus, it was not a complete surprise when the South Yemen government reported earlier this month that it had foiled a coup attempt.

Moscow called for an end to the fighting. And Tass, the official Soviet news agency, issued statements from the prime minister and foreign minister of South Yemen cautioning North Yemen, other Arab states, and the Palestine Liberation Organization not to intervene in the conflict.