They were ahead of the curve and crucially they are an area that has plenty more contact with black people than medieval Europe, thus refuting the concept that homogeneous societies develop racism.
1) No it's not just North Africa. You still haven't apparently bothered to read that small section of text linked...
2) If documented racism occurs among people with lots of contact, that does not "refute" anything about homogenous societies. Obviously, homogenous societies with zero contact won't have DOCUMENTED racism, regardless of whether they are flagrantly racist or not at all, because there's no opportunity to have incidents that get recorded. They can just sit around being racist with nothing of note coming from it. It is the areas where occasional contact occurs that you have to look to to see what was underlying the society previously. Iberia and North Africa are actually decent examples of this, precisely because they didn't just have easy, open borders for both peoples to grow up with large exposure to other races, but both water and a desert in the way and thus made occasional contact, revealing not-particularly-logical widespread racism when they did.
Another nice example of this is if you've ever raised a puppy from a very young age in a homogenous home. It's hard to find human examples of people who have never seen another race member these days (yet are old enough to show racism), but happens all the time with pets. My family's current dog was born in a white breeder's house, has white fur himself, and grew up in our white home. Within his first few weeks, when he started going on walks far enough out, it was obvious: white people walk by, wags tail, licks. Black/hispanic people walk by: flipped his shit and ferociously barked at them, until we trained him not to eventually. VERY first contact, no history of them in any inferior roles (or any roles at all), no abuse from some hispanic guy in the past, nothin.
They are just the Unknown. The Unknown is scary and threatening. It's really as simple as that. Same exact reason people are afraid of change and the darkness.
The central point I am making is that racism historically arose (or at least became notable) as a result of these particular conditions and is not something that has always been there.
I know that. The issue is that your central point has no evidence to back it up.
It is critical to note that even if there WERE no evidence at all of racim prior to the 17th century (although there is), that would by no means be evidence of lack of racism, anyway. To prove that, you need specific accounts of people of different races meeting and affirmatively getting along great in various places. Which you have not provided.
If there were just no evidence at all either way, then the conclusion is "We don't know whether there was racism one way or the other for sure" NOT "There wasn't racism." Because you can't distinguish between no racism Vs. just not writing as much stuff down Vs. just not encountering as many outsiders due to more difficult travel, etc.
They treat a human or an elf or another dwarf in exactly the same way as they would a goblin, provided that they come from that particular hostile civilization.
This is impossible and irrelevant until you explain to us how a dwarf has any idea what civilization a visitor is from aside from race in a split second from 30 yards away, when nobody wears identifying images on their clothing.
unless you check the non-racial cues whatever they are.
Quoted for emphasis. You can't think of any.
Whereas I can cite very clear racial cues: individual civilizations have within-species racial features to them. When you embark, your civ mostly has olive-skinned dwarves or mostly has pale skinned dwarves, and mostly has connected earlobes, or whatever. You can go look for yourself in game (in fact, I think you taught me this earlier). I.e., you can easily distinguish who the bad guys are
by race -- proper race as we mean it more modern-ly, not species. And not really any other way.
In fact, not being racist in DF world would be pretty stupid!