Afghan leader Babrak Karmal resigned today as secretary general of the ruling communist party, in what seemed to be a further move to broaden the base of the Soviet-backed government in Kabul.

Afghan state radio, monitored here, said Babrak had stepped down "because of ill health" and had been replaced by Najibullah, the former head of the Afghan secret police service, Khad. The new leader has only one name. Babrak has been rumored to be under treatment for a lung ailment.

Babrak retained the less important post of chairman of the Revolutionary Council, or president, and kept a seat on the seven-member Politburo.

Babrak's removal came only three days after his return from a month-long stay in Moscow, which was punctuated by articles in the official Soviet press that repeated past criticisms of the Afghan communist party's inability to attract wider support from the Afghan people.

Babrak's departure also came on the eve of the resumption in Geneva of U.N.-sponsored indirect talks between Afghanistan and Pakistan that are to focus on a timetable for Soviet withdrawal from Afghanistan. Diplomats and other observers said the shift raised both new possibilities and new questions for the protracted negotiating process.

[Other internal developments in Afghanistan, as well in Pakistan, are said to cloud prospects in Geneva.]

Speculation had been mounting for nearly a year that the Soviets' dissatisfaction with Babrak, whom they installed as leader following their 1979 invasion of Afghanistan, might lead to his removal.

Kabul radio said Afghan party officials had praised Babrak's leadership but the manner of his removal, and the choice of Najibullah to replace him, suggested to western and Afghan observers here a Soviet-inspired effort to dampen a longstanding factional battle within the party, and to accelerate a campaign to bring more Afghans into government-sponsored politics.

[Some western diplomats in Moscow saw the move as a Soviet effort to step up the war against Afghan guerrillas, while others said it could signal intent to negotiate seriously in the Geneva session, Washington Post correspondent Gary Lee reported. The Soviet news agency Tass reported the shift, quoting the Afghan news agency.]

Najibullah, 39, "is an old-line communist, very close to the Russians . . . and they will hope he can be more popular within the party and among the people than Babrak," said Fazle Akbar, a former director of Afghan State Radio.

"Babrak failed to get the support of the people because he was seen too much as a Soviet puppet," Akbar said. He said Moscow's hope would be that Najibullah might appear more as an indigenous Afghan leader. At the time of the 1979 invasion, the Soviet Union recalled Babrak from a diplomatic post in Czechoslovakia to head the Afghan party and government.

During nearly 6 1/2 years of leadership, Babrak was unable to mend the factional split, which has resulted in assassinations of rival party officials, and has hampered the government's efforts to establish firm administrative control even in the main cities.

Since its founding in 1965, the communist People's Democratic Party of Afghanistan has been bitterly divided between the Khalq, a faction composed mainly of the dominant Pushtun tribes, and the Parcham faction of more urbanized and intellectual party members from non-Pushtun ethnic groups. The Soviets deposed a hard-line Khalqi regime and replaced it with a more pragmatic Parcham-dominated government under Babrak.

Like Babrak, Najibullah is a Parchami leader but, said Akbar, "he is a Pushtun and speaks Pashtu very well, which will be good for his relations with the Khalqis. He may be the best choice for [reducing] the conflict in the party."

Akbar recalled Najibullah from his days as a student leader at Kabul University's medical school. "He was a very good speaker and everyone knew him," Akbar said. Najibullah is a doctor but does not practice medicine.

During Najibullah's term as chief of Khad, the security agency was greatly expanded and became widely regarded as the most effective arm in the government's fight against the Afghan Moslem resistance movement. The resistance movement and independent human rights organizations have accused Khad of widespread torture and other atrocities under Najibullah's leadership.

Last December, Najibullah was promoted from Khad chief to become the Central Committee's secretary in charge of security, in a move that recalled for some observers the two-stage elevation of the late Yuri Andropov from chief of the Soviet KGB to the party leadership.

One of Najibullah's major priorities as Khad chief was the recruitment of Afghan tribes, especially near the border with Pakistan, into a progovernment militia. Afghan observers here say Najibullah's experience with tribal leaders could be an additional factor in his selection. Since last year, Moscow has backed a campaign to involve more tribal leaders in the party.

Last winter, the government tried to demonstrate its success in broadening the party's base, in part by inviting in western journalists. The officials discouraged them from using the word "communist" to describe the government and ruling party, a demonstration of their eagerness to be portrayed as a nationalist Afghan regime.