A military coup yesterday deposed the Ghanaian government of Gen. Frederick Akuffo, according to a communique broadcast over Accra Radio.

The communique, monitored in neighboring Lome, Togo, said the coup's leaders had taken control of the entire country. It ordered all police who had taken refuge in the Accra police headquarters to surrender their arms, saying that the building would be shelled if they did not.

U.S. officials in Washington said the U.S. Embassy in Accra had reported that fighting between the rebels and Akuffo's forces was heavy. They said they did not yet know if the coup was successful.

The coup was apparently staged by the same group of officers who tried to overthrow the Akuffo government May 16. At that time it was reported that they wanted to prevent the restoration of civilian rule following elections scheduled for June 18. Yesterday, however, the broadcast communique said the elections will be held.

Reports reaching Lome yesterday indicated that the rebels had freed Air Force Lt. Jerry Rawlings, leader of last month's unsuccessful attempt to overthrow Akuffo, from prison.

The reports said yesterday's coup was led by Maj. Opoku Mensah, deputy commander of Army forces in Accra.

The military communique ordered members of Akuffo's Supereme Military Council to report to "the Air Force station, Accra, or face the consequences." Two bishops, the president of a student organization and the president of the "national house of chiefs" were also summoned to the air base.

It was not known why-if this was the case-they had not canceled the election.

Akuffo, who came to power in a palace coup last July, had insisted on turning power over to civilians next month.

The Ghanaian military peacefully transferred power to a civilian government in 1969, but following a series of political and economic difficulties, the military moved back into government three years later.

No other African military rulers have voluntarialy surrendered power, although Nigeria's military is scheduled to do so this year.

Rawlings, who was captured after last month's coup attempt, reportedly said at the opening of his trial that he favored an "Ethiopian-style" revolution in Ghana.He reportedly said a bloodbath was necessary to cleanse the country, particularly the armed forces.

Rawlings was said to have denounced corruption within the government and to have accused foreigners of ruining the national economy. He reportedly singled out the country's Lebanese community of about 3,000. CAPTION: Map, no caption, By Dave Cook-The Washington Post