I think it wasn't purposefully racist - he made the bad guys all dark, hairy and warty and in the final battle the bulk of the defenders are from the same culture group so they would naturally all look similar. In the book, the only skin colors I remember being discussed are those of specific royal families and the bad guys themselves. The Hobbits are never described as white - that, I think, is a factor of the collective readers' conciousness and the original artists. If you look hard enough almost anything can be considered racist.
I think he just took the common 'look' of the people around him as a basis for the good guys. He was creating a mythos for the Brits after all.