We all have internalised ableism, because all people are born and raised in an ableist society which heavily impacts how we see and think about disability. It doesn't make you a bad person, you don't have to mean it or even be aware of it, it just is. Learning to understand and recognise it will help make your relationship with and understanding of yourself better (as well as why society is the way it is).
I really recommend you read some of those articles I linked, and start to think about why it is important to you to think of yourself as intelligent (or - why do you worry about being considered unintelligent? According to you this isn't something that even happens to you often, so why does it even matter?), why does this vague note a doctor made in a file some time ago change how you see yourself (do they really know you better? What does "logic deficit" even mean? Does it even matter if you'd not noticed it until now?), does any of it even really matter?
This is a work in progress, just sit with these questions and information, even if it brings discomfort, that's part of growing.