I searched for a while and found it's gold-bug cipher ([wikipedia](https://en.wikipedia.org/wiki/The_Gold-Bug)). Using this [site](https://dcode.fr/gold-bug-poe ) we can get the plaintext easily as follows.
CAPTAI KIDD USED THE GOLD BUG CIPHER TO HIDE THE LOCATIO OF HIS TREASURE I A STORY WRITTE BY EDGAR ALLA POE I FLAG IS **PIRATESANDDAGGERS**