There is a door the mind takes you through when it wants you to collude with it to make things up, especially about you, other people, and what they think about you.
You find and lock that door with meditation.
The mind will still do its wandering and attempt to take you to those same places, but at least now it can’t go too far. Now it functions under close observation.