KABUL, Afghanistan (AP) _ The government today accepted an invitation to a conference in Germany aimed at setting the stage for broad-based negotiations intended to end Afghanistan's 13-year-old war.

On Tuesday, former West German Chancellor Willy Brandt announced in Bonn that his Social Democratic Party would host the three-day conference, beginning Jan. 27. Observers say the conference could be a springboard for broader, U.N.-sponsored peace talks.

Brandt said the three moderate leaders of the Muslim resistance, the deposed Afghan King Zaher Shah and representatives of the Communist-style government of Afghanistan had been invited. Although all three sides have had indirect contact for years, they have never met publically.

The government of President Najibullah accepted the invitation and said it would send Prime Minister Fazle Haq Khaliqyar as its representative.

''I don't think the conference will find a way out of the problem in two or three days,'' said Wader Safi, the civil aviation minister in Najibullah's government. ''But this is sort of a test to see if Afghans can sit together at the same table.''

Although he has made no announcement, diplomatic sources said they also expect former Afghan King Zaher Shah to attend the conference.

The 77-year-old former king was overthrown by a cousin in 1973 and has been living in Italy ever since. More and more Afghans see him as the only person capable of uniting the fighting factions and restoring peace to this war- devastated country.

The three moderate rebel leaders - Pir Syed Ahmed Gilani, Sibghatullah Mojadaddi and Nabi Mohammedi - have not said yet whether they will attend.

The four fundamentalist rebel leaders have repeatedly rejected any talks with the former king or members of Najibullah's government or his Watan (Homeland) Party and have promised to keep fighting.

The rebels have been fighting to overthrow pro-Marxist government installed following an April 1978 military coup.

The rebels were armed and financed by the United States, Saudi Arabia and other sympathetic Arab states, while the Kabul government was supported by the former Soviet Union.

Washington and Moscow stopped all military support to their warring clients on Jan. 1, hoping to encourage them to sit down together and negotiate a peaceful settlement.

The United Nations has proposed a five-point plan as the framework for a settlement. It calls for the cutoff of weapons to all sides and a cease-fire followed by wide-ranging talks that could form a neutral, transition government to oversee elections.

The Pakistani English-language daily, The Nation, reported Thursday that the U.N.-sponsored talks would be held at tne end of February, either in Vienna or Ankara. U.N. officials in Pakistan and Afghanistan said they could not confirm or deny the report.