All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, is His slave and Messenger.
There is no specific Thikr that helps in overcoming the problem you mentioned, but obedience to Allah, The Exalted, is one of the greatest means to fix knowledge in the heart and prevent forgetting it, Allah willing. Among the acts of obedience are: the frequent recitation of Thikr, including Tasbeeh (saying ‘Subhaan Allah’ [Glory be to Allah]); Tahmeed (saying ‘Al-Hamdulillaah’ [All praise is due to Allah]); Takbeer (saying ‘Allahu Akbar’ [Allah is the Greatest]); Tahleel (saying ‘La ilaaha illa Allah’ [none is worthy of worship but Allah]); Hawqalah (saying ‘La hawla wa la quwwata illa billah’ [There is no power nor strength save by Allah]); invoking peace and blessings on the Prophet, sallallaahu ‘alayhi wa sallam; and reciting the Quran. These are all examples of the acts of obedience by means of which you can accomplish this objective and ward off what you fear, Allah willing. You should also make frequent supplication and ask Allah, The Exalted, to teach you what is good for you. Supplication is one of the most effective means to realize your objective, Allah willing.
May Allah guide you to what pleases Him.
Allah Knows best.