Both are true with different meanings:
ability to think and imagine
[uncountable and countable] your thoughts or your ability to think, feel, and imagine things:
in somebody's mind
» There was no doubt in my mind that it was the right decision to make.
» Do you have a clear picture in your mind of what you want?
» A plan began to form in his mind.
» The event is still fresh in most people's minds.
on your/somebody's mind
if something is on your mind, you keep thinking or worrying about it:
(=a lot of problems to worry about)
if something is on your mind, that is what you are thinking about:
» She's the type of person who just says what's on her mind.