Rebel soldiers led by a former military commander battled government troops today in Monrovia, Liberia, in a bloody attempt to wrest control of the government from President Samuel K. Doe, according to diplomatic sources and radio reports from the Liberian capital.

In several radio broadcasts monitored subsequently, Doe claimed to have regained power. In Washington, a State Department spokesman said tonight that Doe apparently has rallied forces and "is on top of things."

But sources at the U.S. Embassy in Monrovia and reports by the British Broadcasting Corp. said earlier that the result of the heavy fighting in the afternoon on the southern outskirts of Monrovia was still unclear at nightfall.

Doe has ordered a dusk-to-dawn curfew in Monrovia, and the country's land borders, along with the international airport, have been closed.

An early-morning announcement on the state-owned radio brought thousands of people into the streets of Monrovia to celebrate the overthrow of Doe by forces commanded by Brig. Gen. Thomas Quiwonkpa.

The broadcast claimed that the rebel forces had seized power and surrounded the city, adding that Doe was "in hiding." Doe was proclaimed the winner of a presidential election last month that opponents charged was fraudulent.

But by early afternoon, according to an official at the U.S. Embassy in Monrovia, the celebratory crowds had cleared the streets. Doe, dressed in military khakis and surrounded by his Executive Mansion guard, summoned reporters to his office to announce that the rebels had been "badly defeated" by his troops.

"Quiwonkpa is not man enough to enter the mansion," said Doe, the 33-year-old former master sergeant who came to power in a 1980 coup in which president William Tolbert and 13 members of his government were killed. Quiwonkpa (pronounced "Quee-WAM-pa") was one of the 17 noncommissioned officers who led that coup.

Quiwonkpa, who was Liberia's top military commander until he had a falling out with Doe in 1983, has spent two years in exile in Baltimore.

Quiwonkpa, a popular figure in Liberia, came on the radio today and accused Doe of a reign of "fear, brutality and blood tyranny." He announced the arrest of several of Doe's senior ministers and called for new elections.

By 2 p.m., according to the embassy official, forces loyal to Doe had regained control of the state radio and begun announcing that the coup had failed. Another radio station, ELWA, owned by a church group, was also regained from the rebels by Doe's forces. Shortly after 6 p.m., state radio said that government ministers seized earlier in the day had been released and that Doe was in charge.

This was disputed tonight by a spokesman for Quiwonkpa's rebels, who called the BBC from the United States and said, "We are in control of the situation . . . . Everything will be settled very fast." He said that Quiwonkpa was leading the coup from an undisclosed location in Monrovia.

An official reached tonight by phone at the U.S. Embassy in Monrovia said it was impossible to determine who was in control of the country. "I'd have to evaluate it as a toss-up at this point," he said.

The U.S. official, who asked not to be identified, said that Quiwonkpa appeared to have gained the support of significant elements of Liberia's Army, which has about 5,000 soldiers.

Doe, he said, had control of the 200-man Executive Mansion guard and the Army's first battalion, a force of about 380 men led by Doe's cousin, Col. Moses Wright.

The U.S. government, long the major benefactor of the 138-year-old nation founded by freed American slaves, has about $450 million of investments in Liberia, including a major Voice of America transmission center, which broadcasts to all of Africa. None of the 3,500 Americans in Liberia was reported injured in today's fighting.

Since Doe came to power five years ago, the U.S. government had pressured him to hold elections and turn control of Liberia over to civilians. As an incentive, the State Department increased assistance to Liberia sixfold to $86 million this year, making the country one of the highest per capita recipients of U.S. aid in the world.

American diplomats in Liberia were disappointed when Doe decided two years ago to become a candidate in the national election, held Oct. 15.

The government said he had garnered 50.9 percent of the vote. But unofficial counts, confirmed by western diplomats, showed that Doe probably received about 25 percent of the vote, and the presidency actually was won by the candidate of the opposition Liberia Action Party, Jackson F. Doe, who is no relation to Samuel Doe.

The Liberia Action Party, along with the other opposition parties in the election, called Doe's victory a sham and refused to participate in his government or recognize its legitimacy. Congress has tied the security portion -- about three-fourths of this year's $86 million in aid -- to a determination that elections, held last month, were "free and fair." The State Department has not made that determination.

After the election, a senior member of Doe's own government said that Quiwonkpa could be expected to return to Liberia to take control of the Army while civilian control of the government was turned over to the Liberian Action Party.

Many residents of Monrovia apparently thought that that is what happened this morning when Quiwonkpa made his radio announcement. About 5,000 persons took to the streets, "whooping it up," as one U.S. diplomat said today, and making the rooster calls that are the rallying cry of the Liberia Action Party.