Police ordered a crowd of nearly 3,000 black youths to disperse from a cemetery near Pretoria where they had gathered to await the body of a black guerrilla executed earlier in the day.

Before the order, tension had been mounting between the police and the youths, some of whom had chanted in Zulu, "Police are dogs."

The early morning hanging of Solomon Mahlangu, 22, was carried out in the face of appeals for clemency from several world leaders, including President Carter. Mahlangu had been condemned for involvement in an urban terrorist campaign against the government policy of racial separation.

The specific action Mahlangu was said to have been involved in left two whites dead and, according to government officials, was the first incident of urban terrorism in the black guerrillas' efforts to oust the white government here.

He was hanged after more than a year of legal attempts to appeal his sentence. The execution is regarded as a signal by the South Affrican government that it intends to maintain a tough stand against those who resort to violence against it. One pro-government paper said today, "Those who choose the path of violence must accept the consequences."

During the day, prision authorities refused to say what they had done with Mahlangu's body.