Before praying, when I say takbiratul Ihram, I keep on forgetting the intention in my mind, such as “I will pray salatul fajr ila qurbatan illa billah”, however, right after the takbir al Ihram, I instantly remember what I’m praying, is such prayer valid? I tend to repeat prayers a lot because of this.

As long as you remember whilst saying Takbir it is sufficient