Fighting between the North Yemen Army and opposition guerrillas backed by South Yemen has escalated sharply in the craggy mountains just north of the border since recent changes in the Marxist leadership of South Yemen, according to diplomatic sources here.

The clashes, which have been kept quiet by the Sanaa government, were described as the most extensive since a three-week border war in March 1979 that prompted President Carter to send an emergency arms shipment to bolster the North against the Soviet-supplied military of the South.

The fighting also demonstrates the constantly shifting ideological and tribal forces that dominate the politics of North Yemen, frustrating Western attempts to define the country's loyalties in terms of a struggle between the United States and the Soviet Union for influence and allies in this strategic southern tip of the Arabian Peninsula.

Ironically, the new fighting appears to result from significant improvement in relations between the two Yemens as well as the demise of president Abdul Fattah Ismail in South Yemen and his replacement by a colleague and fellow Marxist, Ali Nasser Mohadded.

Ismail, regarded as a doctrinaire friend of the Soviet Union, took a personal interest in supporting the National Democratic Front, a vaguely left-wing military and political group opposed to Sanaa government of President Ali Abdullah Saleh. Since Mohammed unseated Ismail as leader of South Yemen on April 21, diplomatic sources said, the Aden government has tried to tighten its grip on the front and its leaders.

The escalated conflict also reflects boldness on the part of the North Yemen Army. Freed from fears that National Democratic Front irregulars could draw support from South Yemen's regular Army as in the past, Saleh apparently has ordered his troops to pursue the rebels more aggressively, analysts here said.

Most fighting has occurred near the towns of Damt and Baadan, in the Ibb region just east of the main road linking Sanaa with the principal southern town of Taiz, according to reports.

The encounters mostly match front guerrillas armed with AK47 Kalashnikov assault rifles and rocket-propelled grenade launchers against the regular North Yemen Army, which also in largely equipped with Soviet weapons. But some tribal militias, motivated by Islamic conservativism and Saudi Arabian aid, have clashed with the guerrillas in the remote mountains on their own.

Similar skirmishes have been reported between Saudi-backed tribesmen and front irregulars who have moved north into the desert near Hawth, about 100 miles north of Sanaa.

Several reasons are cited for South Yemen's attempt to rein in the front. On one hand, Ismail comes from the Hugarieh area inside North Yemen and personally identified with the front's struggle to establish a government in Sanaa less tied to Saudi Arabia and its conservative orientation. Mohammed, a southerner, feels no such loyalty and is believed to be keener than his predecessor to nurture good relations with Sanaa and Saudi Arabia.

In addition, analysts said, Ismail counted on the military force of the front's estimated 3,000 irregulars as a backstop on which he would rely in case of action against him by the South Yemen Army or internal police apparatus. Because of this taint, Mohammed was described as particularly eager to impose tight controls on the front's guerrillas.

Prime Minister Abdul Aziz Abdul Ghani of North Yemen said in an interview that South Yemen also had pledged to reduce support of the front as a gauge of good will in unity talks going on between the two Yemens for the last year. The Aden government had begun putting pressure on the guerillas even before Ismail was pushed from his posts, Abdul Ghani said.

As part of the gesture, Aden radio has stopped broadcasting communiques and military bulletins from the front, sources said, and the South Yemen Army has pulled back from support positions along the border. Moreover, two front leaders, Abdullah Ahmed Omar and Yahya Shami, were escorted last month from Aden to Sanaa, where they talked with North Yemeni officials about a national covenant.

North Yemeni officials have said, apparently in jest, that the two were delivered to Saleh in exchange for some South Yemenis who had been held in Sanaa and wanted for prosecution in Aden. But Omar and Shami have been seen dining in Sanaa restaurants and, although they keep a low profile, they are apparently under little restraint.

In any case, the squeeze in South Yemen has prompted front guerrillas to move in greater numbers across the border into the southern mountains of North Yemen.This has produced several clashes, some of them on a relatively large scale, with the North Yemen Army, diplomatic observers reported.

The North Yemen Army has suffered more than 100 casualties since the first week of May in the sporadic fighting, the analysts estimated. The action is being kept secret by Saleh's military, they emphasized, and most reports are second hand and therefore subject to error.