Heavy fighting erupted in the central African nation of Chad yesterday as armed forces loyal to rival political factions sought to gain control of the capital city of Ndjamena, State Department officials said.

Sketchy reports said that cannon, mortar and automatic rifle exchanges involved Army and security units loyal to Chad's president on the one hand and forces loyal to his defense minister on the other.

The intensity of the battles in the capital and the generally volatile situation in the country prompted the Carter administration to order evacuation of the entire staff of the U.S. Embassy in Ndjamena, including Ambassador Donald Norland.

Apart from the embassy staff and dependents, there are 12 other Americans residing in Chad. All were instructed to be prepared for evacuation. A State Department official said all Americans were safe and in their homes.

There were reports that President Goukouni Oueddei and Defense Minister Hissein Habre had met yesterday to arrange for a cease-fire. But U.S. sources said fighting in the capital continued last night.

The Americans will be evacuated as soon as the cease-fire goes into effect, a State Department official said.

All communications with Chad have been cut and the Ndjamena airport was closed down. U.S. officials said that the Americans would be flown from a French base near the capital where about 1,000 French troops are stationed.

Several hundred European residents have sought refuge at the French Embassy in Ndjamena, the French Foreign Ministry announced.

A destitute former French colony located in the center of Africa, Chad has been in a state of virtual civil war since it became independent in 1960. French troops remained to help keep the peace in a country that also depended on French budgetary subsidies to stay afloat. The French aid amounts to $50 million annually.

For most of the past two decades, the country was ruled by leaders of the 2 million Christians and adherents of tribal religions in the south. Leaders of the 2 million Moslems, who reside in the northern part of the country, took control of the government last year.

The current struggle in the capital followed armed clashes earlier this week between the defense minister's forces and security units loyal to Interior Minister Abba Said in the town of Bokoro, 185 miles east of Ndjamena.

U.S. officials said there was no indication that Abba Said's forces were involved in the fighting yesterday. Most of the nine other armed factions in Chad were reportedly siding with the president.

All 11 factions agreed at a recent conference in Nigeria to pull their troops out of the capital by Feb. 5, but the deadline passed without any apparent change. At the same conference, they signed an agreement to form a provisional coalition government with Oueddei as president until an election within 18 months.

With rival armed factions patrolling the capital, the government was barely functioning. Yet it ensured at least temporarily an end to factional struggles after a civil war 1 1/2 years ago in which thousands of people died.

The only confirmed casualties in the current fighting were a French soldier killed and another wounded in cross fire in the capital.