J. R. R. Tolkien, while writing the Lord Of The Rings, mentioned that this novel was not meant to be taken allegorically.
It is interesting to note that Tolkien resisted the temptation to make his fantasy an allegory. He created incredible backgrounds and back stories for his tales.
Needless to say, people have interpreted The Lord Of The Rings variously, including some who have seen “nefarious” allegories in it. This is not something to be scoffed at however. Each of us sees the world differently.
In contrast, the Roman à clef genre of works are written specifically as an allegory. A key which maps the fiction to the real world is usually published.