BEIJING (AP) _ Students from the Soviet Union, the United States, Western Europe and Africa today sent a letter to Chinese authorities accusing them of racism.

A group of African students mailed another letter to all African embassies in Beijing, charging African countries have ordered their students to stay in China even though the students want to leave.

An African diplomat denied the claim.

Attached to the African students' letter was a separate protest note in which 44 African students from Nanking demanded their countries let them go home.

The letter-writing campaign follows a brawl between African students and Chinese on Christmas Eve in Nanking.

Official Chinese reports said 11 Chinese and two Africans were hurt in the fighting at Hehai University. Chinese students say the fight began when two Chinese women refused to identify themselves as they entered the university with two African men. African students say it started with Chinese students and teachers attacking African students for no reason.

In the letter to authorities, 140 foreign students from about 35 countries, including many black African countries, Australia and Japan, accused Chinese officials of planning the Hehai University brawl and stage-managing subsequent anti-African protests in Nanking.

The letter referred to developments in the first week of January, which ended with 400 Chinese police raiding a guest house outside Nanking.

''Many of us were beaten, some with electric prods, while all of us were restricted phone calls, visits from our diplomats or friends and the freedom to leave,'' said the letter. ''We were treated like prisoners as if we were guilty.''

In the letter to their embassies, African students said their countries have begun ''to threaten and order their students to go to school against the initial demand of the students.'' Hundreds of African students in Nanking and Beijing remain on strike.

The letter called on the goverments to let their students go home.

''We could not understand how the diplomatic corps would seek to sacrifice its students for a racism-infested friendship'' with China, the letter said. ''We should advise our diplomatic missions not to sell our birthrights for friendship.''

Kwadwo Kwakye, acting ambassador for Ghana, denied his country has ordered any of its 26 students to stay in China, as students charge.

One Ghanaian student, Alex Dosoo, was arrested after the brawl in Nanking and jailed for a month.

He was released Jan. 24, a day before President Moussa Traore of Mali, the president of the Organization of African Unity, came to China. The organization had criticized China's handling of the fight and later protests.

China initially ordered Dosoo and two other African students allegedly involved in the fray, out of the country, but later reversed the decision.

One man, Alpha Robinson of Gambia, left.

Kwakye denied students charges today that African embassies are pressuring Dosoo and Boni Lodovic to stay in China and transfer to another university. Both have said repeatedly that they want to go home.

Kwakye said Dosoo is free to return home.

Few of the students have money to pay their fares.

More than 1,500 African students study a variety of subjects ranging from agriculture to literature in China, mostly on Chinese scholarships.