He didn't. He was in fact quite clear that Lord of the Rings was inspired in large part by his experiences in the First World War: Dead Marshes especially, but also Sauron and Saruman and their forces of industrialization.
It has been some years since I read LotR, but wasn’t there one very widespread edition that contained a foreword by Tolkien where he very clearly denied any allegory behind the story, and was obviously fed up by people claiming such?
Tolkien was against reading his works as allegory for any specific historical event, especially if that event related to the Second World War (Sauron is not an allegory for Hitler, for example). But he did mention in his letters that his writing was obviously influenced by his combat experience in the First World War.