The government of Gen. Samuel K. Doe appears to have defeated a coup attempt that brought heavy fighting to the Liberian capital yesterday, according to a U.S. diplomat in that West African nation.

Doe's soldiers patrolled the nearly deserted streets of Monrovia today and manned roadblocks that prevented anyone from leaving the capital, according to the diplomat.

The diplomat, contacted by telephone at the U.S. Embassy in Monrovia, said shooting began at daybreak today on the outskirts of Monrovia, but by noon a tense calm had fallen over the city of 306,000 and that "things seem to be getting back to normal."

"As of right now," the diplomat said late this afternoon, "Doe has been in control of the radio stations for an awfully long time and most of the troops around the city seem to be his."

The three radio stations, which were seized early yesterday by rebels before being retaken by Doe's forces, broadcast urgent appeals today for donations of blood, medical supplies and for medical staff to come back to work at the U.S.-built John F. Kennedy Hospital in Monrovia.

Doe's government has said that 10 rebels and one government soldier were killed in yesterday's fighting. Most of it occurred near the executive mansion, which was reported to be severely damaged.

The coup attempt was led by Gen. Thomas Quiwonkpa, who had been Liberia's top military commander until 1983, when he fled the country after being accused of plotting to overthrow Doe, an ex-sergeant. For several hours yesterday, Quiwonkpa's forces controlled Monrovia. They arrested several ministers in Doe's government and marched in the streets.

By midafternoon, Doe, 35, came on state-owned radio and said he was back in charge and the coup had failed. Fighting continued after the head of state's announcement, however, and diplomats in Monrovia were uncertain who was in control.

The whereabouts of Quiwonkpa, 30, who had helped Doe in his 1980 coup, remained unknown. State-owned radio repeated that Quiwonkpa would be detained. The government told reporters in Monrovia that it had arrested 15 rebels.

The coup attempt came two weeks after Doe had been proclaimed the winner of a presidential election that opponents and diplomatic observers have charged he lost. Ballots were found burning before Doe was announced the winner, and several election laws, which Doe had approved, were violated.

The apparent winner of the October election was the candidate of the Liberian Action Party, Jackson F. Doe, no relation to the head of state.

At a press conference in Monrovia today, Doe's Army chief of staff, Gen. Henry Dubar, reportedly hinted that some members of the Liberian Action Party might have been involved in the coup attempt.

The U.S. diplomat said it was not known if any members of the opposition party had been arrested. Repeated telephone calls to the homes of several of its members went unanswered.

Dubar said that Quiwonkpa, who he charged was joined in the coup attempt by Cuban and Sierra Leonean troops, failed because of a communications breakdown with his forces.

The general said that after Quiwonkpa's rebels had rounded up several senior ministers and taken them to an Army stockade, the rebel leader lost contact with his military support. He said soldiers loyal to Doe then broke into the stockade and released all the ministers as Quiwonkpa fled. He reportedly also claimed that the rebels were armed with weapons made in communist countries.

Quiwonkpa had become a popular figure in Liberia during his two years of exile, which he spent in Baltimore. As head of the armed forces in Doe's government, he had shunned the trappings of power that Doe and many of his aides displayed. He lived in a hut and urged Doe to turn power over to civilians. Doe, in the past two years, has become unpopular with many Liberians, who say his government is inefficient and corrupt.

The U.S. diplomat in Monrovia said the U.S. government was not aware of when or how Quiwonkpa had returned to Liberia from Baltimore. Doe said yesterday that the rebels invaded his country from Ivory Coast, east of Liberia.

The United States is Liberia's dominant ally and aid donor. The country was founded 138 years ago by freed American slaves. U.S. funds provide about one-third of the country's annual budget. Most of the aid is for security and that portion, as a result of congressional action, is contingent on a State Department finding that October's election was "free and fair."

State-owned radio told Liberians this morning to return to work, but reports from the capital said that nearly all stores remained closed.