Racism is a form of mockery. When Abū Dardā said to Bilāl, ‘you son of a black woman,’ he did not technically say anything that was incorrect. It is not about whether what you said was true or not. It is about how the statement is perceived by the person. Whenever you say these and other words or statements in a racist manner it is Ḥarām. Bilāl was no doubt the son of a black woman, but this statement was meant to put him down.
When the Prophet saws heard of this he told Abū Dharr,
إِنَّكَ امْ رؤٌ فِيكَ جَاهِلِيَّة ‘You are someone who has inside of you some ‘jaahiliyyah’’
This is an extremely powerful statement because the Prophet صلى الله عليه وسلم had also said that if the Imān of Abū Dharr was to be placed on one side of a scale and the Imān of everyone else placed on the other side, his Imān would outweigh everyone else’s. Abū Dharr was therefore a great person but this form of mockery was a form of pride. Abū Dharr therefore had to treat this disease with its opposite. He went and put his face in the dirt and told Bilāl to step on his face. Treat extremes with extremes.