Afghanistan's Soviet-installed government declared martial law in the capital, Kabul, yesterday amid the eruption of large anti-Soviet demonstrations and recurrent shooting, according to reports from the Afghan city.

Three civilians were reported killed in shooting on Kabul's streets, but there were no other details of their deaths.

Accounts of the latest developments in Afghanistan were generally sketchy, but a compilation of diplomatic and news service reports from Kabul, Washington, Moscow, New Delhi and Islamabad, Pakistan, painted a picture of mounting popula resistance in the capital to the Soviet military occupation and the Moscow-backed Afghan government. The demonstrations were believed to have been the first major public protests since Afghan communists first took power in April 1978.

In announcing martial law, the eight-week-old Afghan government of President Babrak Karmal ordered all residents of Kabul to turn in unauthorized weapons within 24 hours, prohibited gatherings of more than four persons and clamped a stricter overnight curfew on the city.

Soviet troops and armored personnel carriers were reportedly sent into the capital and stationed around key government buildings. Soviet helicopters, and jet fighter planes flew low over the city, according to reports from foreign residents there.

"The situation is very, very volatile," State Department spokesman Thomas Reston said. The department had received reports of "considerable firing" in Kabul yesterday as what he described as a nationwide general strike entered its second day.

In Moscow, the Soviets news agency Tass said Afghanistan's secret police yesterday arrested a large group of persons, including an American and 16 Pakistanis, on charges of working to subvert the government under orders from foreign intelligence services.

Tass identified the American only as "Robert Lee" and said he was known for his links with the Central Intelligence Agency.

A State Department spokesman said there was a Robert Lee who was a private American citizen looking for a teaching job in Kabul. He termed the charge that Lee was a CIA agent "ridiculous." The spokesman said the department had no confirmation of Lee's arrest, but had no reason to doubt it. d

About 60 private Americans are known to be living in Afghanistan in addition to about 20 U.S. staffers at the American Embassy in Kabul.

The spokesman said there had been no reported difficulties among the American residents in Afghanistan, but he said they were advised to stay at home.

The State Department said that Soviet reinforcements sent to help maintain control of Kabul had "at least fired near or over demonstrating Afghan crowds. A department official said the disturbances had not yet been brought under control and that shooting and the chanting of anti-Soviet slogans continued after nightfall yesterday.

In a statement broadcast by Kabul radio and reported by Tass, the Afghan Interior Ministry said British, American, Pakistani and Chinese "mercenaries" had "resorted to open instigatory and subversive actions in Kabul, trying to disrupt tranquility of the city."

The statement said that the Afghan government was "striving to prevent these incendiary actions" and preserve "democratic norms," but that the mercenaries openly engaged in "plunder and arson."

In Kabul, there were indications that the communist authorities near the possible spread of civil disobedience to government employes. According to the State Department, the official Kabul radio in its martial law announcement ordered civil servants to report for work Saturday, the start of the work week in Afghanistan, and warned citizens not to insult security forces.

An overnight curfew was moved up from 11 p.m. to 8 p.m.

The latest disturbances in Kabul grew out of a strike called Thursday by Afghan Moslem rebels to protest the Soviet military occupation of Afghanistan.

A Soviet strike force overthrew and killed president hafizullah Amin in a coup Dec. 27 when it appeared that his Communist government was losing ground to a Moslem insurgency and might not survive much longer. Moving in with an invasion force that eventually grew to an estimated 70,000 men, the Soviets installed Bakrak, the leader of a rival Afghan Communist faction, in power.

Despite the massive presence of Soviet troops and equipment, however, the insurgency seems to have been intensifying in recent weeks. Thursday's strike appeared to dash Soviet hopes that the new government could restore some stability and gradually attract more popular support.

Nearly all shops in Kabul and its main bazaar closed in defiance of government efforts to force merchants to remain open during the strike.

Thursday night Kabul residents took to their rooftops and shouted slogans such as "Allahu Akbar (God is great) and "Marg bar Shoravi" (Death to the Russians), according to diplomatic reports from the capital. Similar demonstrations took place in neighboring Iran during the last weeks of the shah's rule and have been reported recently in the city of Herat in western Afghanistan.

The strike continued yesterday, although most shops would have closed anyway in observance of the Moslem sabbath, diplomats said. Some stores that normally would have opened remained shuttered, they said.

Reports from Kabul said the strike has now spread to several other provincial cities, including Kandahar, Jalaba, Wardak and Baghlan.

Complicating the government's crisis were the large demonstrations reported to have been staged in different parts of Kabul yesterday.

A Western journalist in Kabul was quoted in one report as saying he saw 2,000 Aghans demonstrating outside a Kabul municipal building, waving green Islamic flags and shouting anti-Soviet slogans.

A correspondent in Kabul for the Japanese newspaper Asahi Shimbun reported, meanwhile, that the rebels have distributed leaflets warning of an attack on Kabul March 10 followed by a "Tet-style offensive" beginning on the Afghan New Year's Day, March 21.

Details of yesterday's reported shooting in Kabul were sketchy. One diplomatic report said that most of the gunfire came from the district of Khai Khana on the northern outskirts of the capital. Firing was also reported in the Sherpur district of Kabul, where a crowd of Afghans demonstrated in the street.

A dispatch from Kabul by the French news agency Agence France-Presse said the Afghan Army had closed Kabul International Airport, reportedly after shooting broke out nearby.

It said that in the evening, hundreds of youthful demonstrators took to the streets firing pistols into the air.