So, basically:
Tolkien himself shows no evidence of being racist in his wrotings. If anything, as a historian and linguist, he appears to have had a great deal of respect for many different cultures, and an understanding of a lot of things that many people in his time likely would not have. He was still an Englishman, and so he culturally probably had some blind spots, but nothing too crazy.
When it comes to the books themselves, his inspiration largely came from the myths and legends of northern Europe, and as such, a lot of the people in his stories look like they are from northern Europe. There are a few references in Lord of the Rings to the evil humans as being "swarthy southrons" which is, truly, a pretty racialized way of describing them.
However, this is emphatically undercut in the text when Faramir comes upon a dead enemy soldier, and goes on a monologue about how this young man could not have truly been evil, because no human really can, and he wonders about what lies he was likely told that brought him to die so far from his home and family. It can be argued then that, rather than dehumanizing some people, Tolkien seems to deliberately undercut any racial notions the reader may have about the "evil" humans. Faramir implies that this can happen to any Mortal human, and if not for a twist of fate it could be any of us.
With that out of the way, there are a few other things that are sometimes marked as racist in Tolkien's work. One of the big ones is the depiction of dwarves, which some say is full of Jewish stereotypes; Tolkien's dwarves have large noses, like gold, and are generally rather insular. Of course, this is just the way dwarves are always described in folklore, and if they were a hidden anti-Semitic stereotype, wouldn't their depiction be a tad different? The dwarves that we see in the Hobbit and Lord of the Rings are a kind and honorable people, albeit with a rough and guarded exterior (you would be that way too if all your ancestors got killed by dragons). A far cry from the conniving and shifty stereotype of Jews.
And racism does exist in the books, and is thoroughly rejected by the narrative! Elves and dwarves don't like each other, for reasons that are half-remembered and don't make a ton of sense. (Side note: its explained in the Silmarillion to some extent, and it basically is the result of some magic objects more powerful and more cursed than the Ring, which all people of Middle Earth coveted to the point that they were killing each other. It was a very dumb incident that led to the animosity of elves and dwarves, and at the time they were both aware of it, but things spun out of control; all at the behest of Sauron's boss Melkor, the literal Satan of Middle Earth.) Gimli is treated very poorly by a lot of Elves, and even by Legolas at first, but as the narrative progresses we see both of them essentially get woke, to the point that they become best friends for centuries, and we are told spend time bringing both of their peoples to better understanding of the other.
So, tl;dr
While there are certain aspects of the story that may seem racist on an extremely superficial level, it is almost impossible to say, upon reading in full, that there are even racist undertones. Certainly other fantasy works copying Tolkien have been really racist, but that should not color the quite anti-racist message of his work. In fact, you would be very hard-pressed to even find his work to be imperialistic or colonialistic, despite being written by a rather conservative Englishman born in the 1880s. Its safe to say, I think, that Tolkien hated war and strife among people, having seen its worst form firsthand at the Battle of the Somme, and later watching his own children go off to fight another world war within his lifetime.