I recently had a conversation with someone, a member of a minority group in tech, who was discussing feelings of inferiority, both professionally and personally. I encouraged this individual to think about where those assessments of self were coming from. Were the thoughts valid indications of places where improvement was possible or were they not? The aspiring technologist realized that these negative thoughts were from some "other" internal voice, a nagging monologue of statements like "You're not good enough." By identifying those thoughts not only as something from an unhelpful source, but also as thoughts that weren't useful or beneficial, the person was able to better take control of their own perspective and view of themself and the world.
Explaining the same idea with an analogy, imagine a delivery to your dorm/home/apartment. When packages arrive at your house, they're labeled: one from family, an Amazon delivery, and an item of unknown origin, for instance. Chances are you leave the unlabeled delivery outside, bringing the others indoors, as you trust the senders and know the contents will add value to your life.
Let the home be a symbol for your mind and the packages the thoughts that you allow to take up space within it. Although it's easy to let your thoughts govern your mood and actions, it can be much more useful to consciously label them, determining which ones serve you and which don't.
A good guiding question is, "Who said that?" If the answer isn't someone whose view on the situation is relevant, constructive, and well-informed, then you can leave that thought outside the metaphorical door into your mind.