King Hassan of Morocco accepted proposals for a cease-fire today and offered to allow a "controlled referendum" to determine the future of the disputed Western Sahara, where Morocco and guerrillas backed by Algeria and Libya have been fighting a war for six years.

Until today the pro-Western monarch had always resisted proposals for a plebiscite of the people of the barren, Colorado-sized territory, since he maintains that the former Spanish colony is part of Morocco. The leftist guerrillas, known as the Polisario Front, want to create an independent Sahara Arab Democratic Republic for the fewer than 100,000 inhabitants.

Hassan's announcement at the Organization of African Unit summit here only partially eased the tensions over one of Africa's most divisive issues, since many aspects remain to be resolved.

Shortly after his speech, Hassan walked out of the meeting when President Ould Haidallah of neighboring Mauritania made several references to flagrant interference" in his country's internal affairs by Morocco. Mauritania, which supports the guerrillas, has charged that Morocco tried to foment a coup two months ago.

The Western Sahara was ceded by Spain jointly to Morocco and Mauritania in 1976, but Mauritania abandoned its claim in 1979 and concluded peace with the guerrillas.

The Polisario immediately rejected Hassan's move today, calling it "a pernicious formula to legitimize his military occupation."

[But President Chadli Benjedid of Algeria, a principal Polisario backer, called Hassan's speech "a step forward in the search for peace," Reuter reported.]

King Hassan gave no details on how the referendum would be conducted, who would be allowed to vote and how the cease-fire would be implemented. He did accept an OAU mediation committee proposal for a cease-fire, return of troops to barracks and an internationally supervised referendum.

There are probably more combatants in the barren country than civilian inhabitants, since Morocco is estimated to have more than 80,000 troops tied down in the guerrilla war, while Polisario strength is estimated at 20,000.

Although the phosphate-rich territory is mostly desert and sparsely populated, the issue has threatened to break up the 50-nation OAU. More than half the members have recognized Polisario's Sahara Arab Democratic Republic and demanded that it be admitted to the OAU.

Hassan, in turn, had threatened to pull his pro-Western nation out of the OAU and take along several other conservative governments on the continent including Egypt, Senegal and the Ivory Coast.

Although nationalism is at the root of the problem, the issue does have East-West connotations since the Polisario fighters receive Soviet-made arms from Algeria and Libya. Morocco's military is American-equipped, and a recent agreement to supply Hassan with jet fighters stirred criticism in a number of African countries that support Saharan independence.

In his speech today, Hassan said, "We have decided to start a procedure of controlled referendum, the modalities of which would satisfy both the last recommendations of the ad hoc committee [of the OAU] and the conviction which Morocco has of its legitimate rights."

That leaves considerable area for disagreement since Hassan said as recently as Wednesday in a Casablanca speech that Morocco "would not give up a grain of sand" in the Western Sahara.

Peter Onu, the OAU's assistant secretary general, told reporters "everybody welcomed the idea, but the important thing is how to implement the recommendation about the referendum."

One key problem is to determine who is a Saharan and thus eligible to vote. The Polisario maintain that there are tens of thousands of Saharan refugees in camps in Algeria and Mauritania, but Morocco denies that they are Saharans.

A seven-nation OAU mediation committee began meetings late tonight with representatives of Morocco, Algeria and Mauritania to try to work out some of the "Modalities," but it was expected that negotiations would continue for months.

King Hassan's maneuver seemed designed to at least temporarily remove the Western Sahara issue from the forefront of Africa's problems, and thus African leaders were willing to go along at the expense of the Polisario.

Ibrahim Hakim, the so-called Polisario foreign minister, left no doubt about his attitude toward Hassan's offer.

"How arrogant and how scornful to ask, as he asked Africa today, to go back on its word and sacrifice-cardinal principles of its charter to satisfy Moroccan expansionism," he said.

"Hassan outflanked his opponents," a Western diplomat said, meaning that he was able to take advantage of Africa's growing concern over Libyan moves on the continent.

Libya's military intervention in Chad is the key African concern at this summit. Sudanese President Jaafar Nimeri told the summit that Libya has "expansionist ambitions, which threaten peace and security in the region and threatens neighboring states." He demanded a Libyan withdrawal from Chad.

Sudan and Libya, long at odds, were on the verge of breaking relations today as both countries recalled their diplomats after a bomb explosion at the Chadian Embassy in Khartoum, which Sudan blamed on Libya.

The Libyans also had problems in Uganda, where two of their diplomats are being held under house arrest. The Uganda internal affairs minister charged in parliament that the envoys were involved in illegally bringing arms into the country.

In addition, many leaders are urging that next year's summit be shifted away from the Libyan capital, Tripoli, a venue that would mean Libya's leader, Col. Muammar Qaddafi, would be the spokesman for Africa next year.