A clash last month between Chinese and African students on a university campus in the city of Tianjin is turning into an embarrassing problem for Peking, sharply underscoring continuing frictions between the two groups.

China, as part of its nonaligned independent foreign policy, repeatedly professes support for black Africa and cultivates the friendship of African leaders. But the incident at Tianjin University -- in which African and other foreign students say they were attacked by Chinese students in a violent, five-hour melee -- has highlighted problems that African students say they encounter daily in China.

Several students were injured in the fighting, which erupted during a dance, and many witnesses said it was a miracle that no one was killed or seriously hurt by flying bricks and glass.

Eighteen foreign students, most of them Africans, have since come to Peking, which is about 100 miles northwest of Tianjin, and the incident is in the hands of the students' respective embassies and China's State Commission on Education, which is trying to negotiate a resolution of the incident. Some of the students say they never want to return to Tianjin because it has become too dangerous for them there.

The Chinese apparently had tried to keep the students from coming to Peking because of the presence here of foreign diplomats and journalists. The Chinese have tried to play down the incident and, according to one Asian ambassador, have kept a tight lid on information. At a weekly press briefing today, Foreign Ministry spokesman Ma Yuzhen described the clash as an "isolated incident" and said "it has nothing to do with the so-called racial discrimination" mentioned in some news reports.

But African students interviewed here said it highlights the prejudice and harassment they must endure. Africans make up one of the largest groups of foreign students in China. Several incidents during the past few years between Chinese and Africans have resulted in injuries. Shanghai University students have rioted twice against black Africans, in 1979 and again in 1982. In late 1983, an African student was seriously beaten following an argument over beer in Peking.

One black African student, who requested anonymity, said that wherever he went in China, Chinese taunted him with cries of heigui, which means black devil. Chinese frequently accuse black African students of chasing women and starting fights. "Clashes are commonplace and they often involve girls," said a Chinese intellectual who witnessed one of the first fights in the 1960s.

A Peking journal, the China Legal Newspaper, Wednesday reported an attack by a group of Chinese youths against a Moroccan youth and his Japanese girlfriend, according to a United Press International dispatch. The newspaper said the unidentified Moroccan and his companion were assaulted near the gates of Peking's People's University.

Black African students interviewed here yesterday said the Tianjin incident began shortly before midnight on May 24 when Chinese students approached them and asked them to turn down the music at a dance they were holding to mark African Liberation Day. The students said the dance was to end at midnight. Then, they said, with no warning, the Chinese students attacked them, hurling stones, bricks and bottles.

Several foreign students and teachers asked the Chinese police to intervene and stop the riot but the police did not halt the violence until 5 a.m.

Police later said two African students, a Kenyan and a Rwandan, had started a fight with Chinese students that led to the siege. But the two denied having attacked Chinese students.

The Kenyan, who did not want his name used, said in a telephone interview yesterday that he and his colleagues were being made "scapegoats" by the Chinese.

According to the students and diplomats, university officials said seven Chinese students were injured by the Africans, but no independent observers or diplomats have been allowed to see them.

African students interviewed in Peking said university officials woke them shortly before 2 a.m. on May 31 at the hotel where they were being held after the riot and told them the Chinese students were planning another attack. They promised to take the students to Peking but did not head in that direction.

The students protested and refused to go on. Then, after agreeing to go to Peking, the bus driver at one point said he had run out of gas. A university official tried to get the 18 students to stay at a hostel, but the students refused and started walking.

About seven hours and 18 miles later, the university officials and police relented and picked the students up, driving them the rest of the way.