Tolkien hated it when The Lord of the Rings was called an allegory, and that goes for The Hobbit too. Do not directly apply the one-to-one ratio here. On the other hand, the books do have a strong message to send. Races are artificial, and the hatred between them is meaningless. For example, why do elves and dwarves hate each other? They hate each other because of deeply-held, socially-ingrained societal prejudices. Similar rivalries and hatred existed and still exists in Europe. Also, when they are threatened races will form alliances, such as in The Battle of Five armies. The same thing has happened throughout Europe's history.
It is important to remember what Tolkien's thoughts about this issue were as maadhav19 highlights above. Crucially, Tolkien himself deliberately rejected any allegorical reading of his novel, and thus we would be wise to not read too much into such claims. It is interesting however that hobbits were supposedly based on Englishmen, so perhaps, in spite of Tolkien's disavowels, he did have some kind of allegory in mind, at least unconsciously.
You might look at the author's notes in the Lord of the Rings, where Tolkien himself discusses whether there are parallels between the plot of LOTR and the course of WWII. I realize this isn't The Hobbit, but it is a direction to look. Tolkien does not give much credence to the idea that LOTR is modeled after WWII, but reading it might give you an idea what his thoughts on the races of Elves, Men, and Dwarves were in relation to European nationalities in the early 20th century.
Incidentally, he did liken his Middle-Earth to a sort of ancient mythology for the evolution of Europe, so it could be plausible.
Get Ahead with eNotes
Start your 48-hour free trial to access everything you need to rise to the top of the class. Enjoy expert answers and study guides ad-free and take your learning to the next level.
Already a member? Log in here.