The research is clear: children absorb prevailing racial biases unless the adults in their lives speak with them explicitly about race.*
With race, the environment is only part of the message. If you are a white parent and you raise your child in a diverse community, don’t expect him or her to develop unbiased attitudes simply through exposure to people of other races - although cross-racial friendships play a vital role.
You must talk about it.
Use conversations about gender as a model. Just as you point out - hopefully often - that girls can do the same work or activities as boys, substitute race for gender: “Brown or black people can be doctors (or firefighters or princesses …) just like white people.”
When you watch a television show or read a book with your child, point out race. Say you’re glad to see that the show or story includes people of different races, or you wonder why it only includes white people. "That's not fair, is it?"
Phyllis Katz, a researcher of racial attitudes in young children, says, “It’s not complicated what to say. It’s only a matter of how often we reinforce it.”*
If you are a person of color, you likely have many conversations already with your young child about race, by necessity, hopefully about racial pride as well as bias and unfairness. If you're white, these conversations can feel forced and uncomfortable at first. Push through the discomfort and make race explicit. It will get easier over time, and will pave the way for more complex, in-depth discussions about race as your child gets older.
* See Chapter 3 of Nurture Shock by Po Bronson and Ashley Merryman: “Why White Parents Don’t Talk About Race”