High standards + encouragement works. You can help mitigate stereotype threat by providing effective feedback that also lets the student know that you are expecting high performance from them, e.g., “Most students struggle with this. It’s difficult! But I am certain you can do it.”
Provide role models. Use examples of well-known computer scientists in your class that are diverse--women, minorities--without necessarily commenting on their gender or race.
No stereotypes are good stereotypes. Even positive stereotypes can have negative effects. Be mindful of impact. Comments that point out the positive characteristics of a stereotyped group can, in some situations, trigger stereotype threat. They may also divide between students.
Be careful with humor. Humor can build social connection but it can also divide. When using anecdotes or asides be wary of relying on stereotypes. Not all humor is helpful -- or funny.