basically yeah, maybe some meditation will work and that memory will be gone.
The "dirty mind" shit will appear when you saw sexual content and you see maybe a video where a thing in there, reminds you of that sexual content so your brain reacts with "hoho shit my mind dirty dirty I'm on the naughty list now"
It mostly occurs on kids. Some kids made sexual content and other kids watch those and get "dirty minded" from it, it will repeat.