The Soviet installed Afghan government is trying to portray itself as the defender of the Islamic faith against rebelling tribesmen, accusing them of destroying mosques and killing Moslem clergy.

The campaign, repeated almost daily on Kabul radio, is an attempt to turn the tables on the rebels, who have been fighting the government under the banner of Islam for the past 21 months.

The rebellion began in response to the policies of the Marxist government of the late Nur Mohammad Taraki soon after he took power in a bloody coup in April 1978. His programs were seen by the rebels as an intrusion of "godless communism" into the Islamic traditions of Afghanistan.

In its most serious charge, the Afghan government has accused the rebels of trying to blow up the most sacred mosque in Afghanistan -- the Tomb of Ali, the fourth imam of Islam. The tomb is located in Mazar i-Sharif in northern Afghanistan. This charge was repeated twice on Kabul radio during the past week and echoed Monday in the Soviet Communist Party newspaper Pravda.

"It is inconceivable that an Afghan Moslem would dare attempt such an act," said an Afghan refugee source here. He said any attempt to dynamite a mosque would more likely be carried out by members of the ruling Marxist party "who have no regard for religious sanctity."

The government, however, is persisting in its campaign to make the rebels appear to be anti-Islamic.

In a speech last week to religious leaders in Kabul, Afghan President Babrak Karmal accused the rebels of "creating war conditions in the country by killing innocent children and people, destroying schools and mosques.

"They are criminals,' Babrak continued, "and should be dealt with in accordance with the basic principles of Islamic law."

He said religious leaders "should always be respected so that you can carry out the sacred mission of Islam . . . The government of Afghanistan will help the religious leaders to successfully achieve that religious mission."

Babrak, whose government was installed after Soviet troops invaded Afghanistan in late December," said the country should live according to Islamic principles "so Islam would be spread from Afghanistan to other regions of the world."

Kabul radio reported that the religious leaders "prayed for the success of the Democratic Republic of Afghanistan under the leadership of Babrak Karmal."

For his part, Babrak vowed that the revolution will succeed "with the help of the almighty God and the sacred religion of Islam."

In reporting on the attempted dynamiting of the mosque, on Monday, the radio called the rebels "the agents and servants of imperialism" who are "trying to crate an atmosphere of terror in the country."

According to last week's report on the attempt, a police officer uncovered the plot to blow up the mosque with more than four pounds of dynamite.

Diplomats here discounted the radio's claim that rebels had attempted to blow up a mosque. "The rebels may occasionally shoot a few progovernment mullahs, but I cannot see them blowing up the mosques. It just does not fit," one diplomat said here.

"The Babrak government is shammering away on the theme that they are the real defenders of Islam. If you do anything long enough in a country like Afghanistan it will begin to be believed," the diplomat said.

Meanwhile, Kabul radio has intensified its attacks on one of the most popular rebel leaders, Gulbuddin Hekmatyar. His pictures are pasted on walls in Kabul, indicating the growing strength of his organization, Hezbi Islami.

Sources here report that Hekmatyar and Burhanuddin Rabbani, another rebel leader gaining strength in Kabul, have begun issuing party cards to residents of the city.

The Babrak government is issuing its own identify cards, and reportedly is trying to restrict access to Kabul. It is also using radio to heavily advertise new libraries set up by the Soviets that distribute magazines and information on Soviet aid to Afghanistan.

Seven members of Afghanistan's Olympic wrestling team fled to Pakistan to avoid participating in the Moscow Games, according to reports reaching here. But four well-known Afghan wrestlers did go to Moscow despite alleged threats on their lives by the rebel fighters.

Members of the Afghan volleyball and soccer teams also have fled the country to avoid taking part in the Moscow Games, according to Afghan sources.

According to Western diplomatic reports from Kabul, 27 persons were killed on the night of June 29 either by the insurgents or as part of the feud between the two wings of the ruling People's Democratic Party of Afghanistan.