In order to portray the Prophet (ﷺ) as a racist, special emphasis has been laid on the contrast between colours where he is shown as a very whitish white man as compared to the dark slaves he owned. Firstly, his (ﷺ)’s colour was not what we consider today as white i.e. of European origin. That white was referred to as yellow by the Arabs (either due to the blonde hair or the skin colour) and what the Arabs meant by white was a light skinned person from the Arabic skin tone.
Secondly, the Prophet (ﷺ) did not own only black slaves. Slavery was common in those days and slaves came in all colours and races. He (ﷺ) came as a prophet in a society where racism was rampant and slaves existed from before who were black as well as Arab. To say that he only owned black slaves would be a deceit. One may ask as to why he continued to own slaves even if slavery was rampant instead of letting them free? Here is a quote from a historical book on slavery:
Noting the differences with chattel slavery in the Americas, Europeans often characterized slaver in the IOW as mild. The British in 19th century India even descried slavery as a form of poor relief, saving destitute people from starvation.
This helps explain the remarkable absence of class-consciousness and of revolt amongst IOW slaves who generally sought to integrate themselves into the slave-holding society that provided them with basic sustenance and sometimes the chance of an enhance lifestyle. It also explains why some slaves who were presented with the opportunity to gain freedom through manumission or redemption rejected it in favour of retaining their slave status.