The Organization of African Unity today dealt twin blows to Libyan leader Muammar Qaddafi, rejecting his bid for leadership of the continent-wide political forum and at least temporarily defusing a dispute over the Polisario Front, the Qaddafi-backed guerrillas who are fighting Morocco for control of the Western Sahara.

The two issues had deeply divided the trouble-plagued body, Africa's most important political assembly, for 16 months, and today's actions, which allowed the summit finally to open, pulled the organization back from the brink of collapse.

Ethiopian President Mengistu Haile Mariam was chosen by consensus to succeed Kenyan President Daniel arap Moi as Africa's titular spokesman, a decisive rebuff to Qaddafi.

Earlier, the Polisario Front, whose disputed claim to be the OAU's 51st member had spoiled an attempt to convene the summit last year, announced that its delegation would not attend the opening session. Qaddafi, who flew in unexpectedly for the meeting on Sunday, did not attend the opening, nor did his delegation.

Many black African states apparently were rankled by Qaddafi's ambition to become the continent's spokesman and today's decision to name Mengistu as chairman came in an informal meeting before the opening session at which it was announced.

The two attempts to convene the 19th summit last year, both in Tripoli, Libya, foundered, the first time over the Western Sahara issue and the second over Qaddafi's opposition to the seating of the Chad government led by Hissene Habre, who had defeated Libyan ally Goukouni Oueddei in Chad's civil war.

The Habre delegation was seated today without incident.

"Africa has had a glorious victory," said Ugandan President Milton Obote to the applause of the other delegates after the announcement of Mengistu as the organization's next chairman.

The Polisario compromise was announced barely three hours before the summit opened by the front's foreign minister, Ibrahim Hakim.

"The Sahara Arab Democratic Republic," he said on the steps of Africa Hall, seat of the OAU's secretariat, "has taken into consideration the interests of Africa, and in conformity with our wish to continue in African unity, which is threatened by Moroccan expansionism supported by the United States . . . has decided momentarily and temporarily" not to participate in the organization's 19th summit.

Admission of the self-proclaimed SADR had been in dispute since February 1982 when the organization's secretary general, Edem Kodjo of Togo, recognized its sovereignty without a full membership vote.

Twenty-six OAU members recognize the government representing the Polisario guerrillas while 24 more conservative members do not.

Intensive behind-the-scenes negotiations on the issue over the past two days had seemed doomed to failure because of the intransigence of Qaddafi, who supports and recognizes the SADR, and the followers of Morocco, an ally of the United States that continues to fight for control of the disputed former Spanish colony.

So close was the outcome of today's attempt to open the summit for the third day running that, according to key conference sources, Moi's aides spent the morning writing two versions of his opening speech.

One, which was scrapped, announced that he was handing over the chairmanship to the secretariat prior to leaving the meeting Thursday morning.

The other, which he delivered, expressed his "profound gratitude" to those members who had worked tirelessly to save the OAU from "the most serious crisis it has experienced in its history."

Moi fiercely assailed South Africa, urging support in "all possible and practical ways" for "liberation movements" in that country.

He also delivered a plea to the government in Pretoria to spare the lives of three African National Congress guerrillas who are scheduled to be hanged Thursday.