Recognize that classic fantasy settings are racist.
Tolkien's, Tolkien imitators', D&D and the many D&D-derivative fantasy videogame settings that followed. If you're thinking, "Tolkien wasn't a Nazi, how do I imitate his writing", the answer is you shouldn't.
Ever noticed how, when a Dark Lord rises, his or her armies often include the usual complement of the "ugly" races (orcs, goblins, trolls), but also renegades, criminals, ambitious minor nobles, and dark magicians of the "pretty" races, who then proceed to collaborate reasonably well, while Our Heroes are urgently needed to stop the elf prince from trying to rip out the dwarf queen's beard over some perceived millennia-old slight? These stories often contain stock platitudes about unity and tolerance, but it doesn't negate the fact that the default state of Good correlates with casual racism and Evil correlates with puppy-kicking, mustache-twirling, but otherwise commendable meritocracy.
Ditch the word "race".
Race used to mean "ethnicity" (a meaning that could be applied to the original folkloric peoples) and now means, basically, "skin color". Unless "human" is the equivalent of an ethnicity in your world (and maybe even then), ditch it - you don't need either the historical or modern baggage.
Instead, use "peoples" or "nations". (Some writers use "folk" -- it really grates on me for some reason and won't mesh well with the writing unless you artificially age the style.) As an author, unless your narrator is prejudiced, apply the chosen word to all sapient social humanoids and "monsters".
Decide early on if the different peoples are different species.
This is a worldbuilding aspect that you have to decide early, because it determines what kinds of large-scale conflicts are possible in the story -- very important for epic fantasy, which often poses a threat to the world and a need for the world to unite. Possibility of interbreeding is a strong drive toward unity, multinational societies and states. Incompatibility of staple food production methods favors separatism and isolation. The more time you spend designing the economic aspects of civilizations, the less your writing will need to fall back on lazy generic stereotypes.
As the narrator, do not ascribe "natural" personality traits to fantasy peoples.
Elves are not inherently noble and goblins are not inherently treacherous. But it may be that elves live in forest sanctuaries in relative isolation from the outside world, and, to prevent perpetual grudge-holding No Exit style, they have collectively agreed to never lie. Meanwhile, goblins wander the wastelands and have to trade for staple resources. A goblin won't "honorably duel" a much stronger human, and in a world where status is inextricably linked to fighting prowess, what goblins do to gain the upper hand against humans the latter consider "cheating". Obviously, don't have naturally evil or naturally stupid peoples.
If you must have Demons in the Judeo-Christian / D&D sense, do not have a Demon civilization.
You can have weird opposite-world people who live underground, spoil milk, wear pants on their heads, and don't understand the concept of honor. You can't have a culture of sapient beings who always wish ill on humanity and have to be killed on sight.
Avoid Total War.
Wars of extinction were almost never a thing in the historical period fantasy commonly styles itself after.
If goblins raid your village, rustle some cattle and kill three farmers in a fight, you raid their village, kill their fighters, and take their priest's stash of medicinal herbs and magic armor they'd found in an abandoned dragon's lair. You do not tie them to volcanoes and blow them up with hydrogen bombs -- that'd be seriously messed up and you'd be the next Ultimate Evil if you did it.
The same goes if, instead of goblins, dark elves show up, steal the dreams of the village's children and the voices of cockerels, stick three of the villagers with poison darts and carry them off to be sacrificed to the blood tree -- raid back, free the captives, take valuables. It may be creepier than a cattle raid, but it's not more capital-E Evil.
Do not style different fantasy peoples after different real-world "exotic" cultures.
Even if the styling is supposed to be understood as flattering. Even if you mix and match them, as long as a trait will still be recognized as characterizing a specific culture by a reasonably educated reader.
My story is set in Fantasy Japan, where Human samurai fight Bakemono (goblins) and Oni (orcs) and romance Yuki-onna (elves).
My story is set in a fantasy world where Humans are Greek, Elves are Maasai, and Orcs are Ukrainian.
Watch out for pointlessly racialized loanwords, don't use them when a native equivalent exists. If the words for leader for Humans, Elves and Orcs are "archon", "laibon", and "hetman" respectively, it's the NO example above once again.
The exception to this is if there are no humans in your setting, and cultures are represented by their signature civilized non-humans.
Avoid words associated with tribal cultures when describing tribal cultures.
Tribes in fantasy are a form of social organization used by Stone Age "ugly" "monstrous" enemy peoples, whom the heroes fight and kill, often to extinction. Your characters are not anthropologists and your peoples can't be blamed for their lack of technological progress. So the orc leader is technically a chieftain, but the narrator and the characters will refer to him as a king.
Don't use conspicuous phonetic patterns of real cultures or their stereotypes in names.
Instead, invent some, or find some that are shared by disparate real cultures.
Don't ascribe annoying speech patterns to some of your fantasy peoples.
Annoying speech patterns portray the characters so afflicted as dumb and unpleasant. Also, they make reading unpleasant, and that's something best avoided.