Many Islamic scholars were racist. A quick Google search can bring up dozens of quotations that are almost reminiscent of 19th century eugenics. The 14th century Moroccan writer Ibn Battuta said that "Of the neighbors of the Bujja, Maqdisi had heard that "there is no marriage among them; the child does not know his father, and they eat people -- but God knows best. As for the Zanj, they are people of black color, flat noses, kinky hair, and little understanding or intelligence.", while 10th century Persian historian Mohammed ibn Jarir al-Tabari claimed that "Noah prayed that the prophets and apostles would be descended from Shem and kings would be from Japheth. He prayed that the African’s color would change so that their descendants would be slaves to the Arabs and Turks.".
Did this racist rhetoric, along with the institutional enslavement of Sub-saharan African peoples by medieval Muslims, have an affect on the transatlantic slave trade and later attitudes towards Black people?
Similarly, these Muslim writers saw Africans as a distinct group different from them. But did they view themselves and Europeans together as "white", or did that concept not exist?
A quick Google search can bring up dozens of quotations of pretty much anything you want. Saying that "many Islamic scholars" were racist shows a very shallow and superficial reading of history. I can easily argue that "many Islamic scholars" were pro-Black and anti white.
Part of what renders blackness superior to whiteness -
And truth has many levels and depths -
Is that darkness is never blamed for being black
While extreme whiteness may be rebuked for being white.
~Abul Hasan ar-Rumi
As for whites, I am repulsed by them
I have no appetite for the color of old age.
~al Baha Zuhayr
Now, don't misunderstand me. It is quite clear that racist sentiments did indeed exist in Islamic history. No doubt about that. However, many non-historians fall into the all too common fallacy of making false equivalencies. Just because race/color prejudice defined European/American history for so long does not mean that racism in Muslim societies also defined those societies and the lives of black people within them. For one, most slaves in Muslim lands were not black. Nor were most blacks slaves. In fact, most slaves were white, of Turkish origin. Furthermore, although slavery existed in Muslim lands, it was not a slave society but rather a society with slaves.
As far as all Muslims seeing Africans as a distinct group, this is utter nonsense. There were plenty of African Muslims, many of whom ended up in America as slaves.
Racism as we know it is a modern phenomenon. The early Islamic era, as with most pre-modern eras and peoples, was captivated by the exotic, and the foreign. There was an active genre of travel literature about far off lands. There are certain expectations of this genre. 1) People elsewhere are different! (color, hair, customs) - how fun! This doesn't mean they are inferior because of their differences but that they are different. 2) Their culture/religion/practices is not as enlightened as ours! - this is a bit delicate. This has nothing to do with race, more to do so with culture and religion and conceptual frameworks.