I'm going to defend a very racist joke said to a black person because of the context of it
Why would you ever defend a racist joke?
Shouldn't you be able to make fun of someone if you've been in the same group your whole lives?
Even if you have been friends with someone their whole life, defending a racist joke that is at their expense is unforgiveable and a sure fire way to lose that friend. Instead of defending the joke, stand up for your friend. That's what a real friend would do.
I think I am a real friend, but I'm going to defend the joke.
Contrary to what you are saying,  you are not being a real friend and it's never okay to defend a joke that is racist. Have you thought about how your friend feels in private and how the history of the joke has very deep wounds?