The root of the problem is human nature. As for possible solutions, unfortunately there are no foolproof solutions.
Explanation:
It's in our nature to compare ourselves to others. This is why some people think of those who are inherently different to be "inferior" to themselves. While it's true that many of us do not think this way, the issue is still caused by the way we subconsciously pinpoint the differences in the people around us. Since we're dealing with our own nature here, there isn't a concrete solution to the problem. No matter how much any of us preach about how racism is wrong, there will always be people who disagree. It's a very saddening conclusion, but we've searched for a solution for many years- only to come up empty handed.
Well if the characters in the story know about an apocalypse then they should prepare for what could happen. they should use the knowledge of what they know about the apocalypse, they should use that knowledge and prepare.