Claude McKay's purpose for writing the poem "If We Must Die" is to show that our actions that lead up to our death - our life, in fact - must be one of brave and courageous acts. The poet also says that our fight must be a noble one, and he alludes that the cause we are fighting for must be a noble one as well...
If we must die, O let us nobly die,
So that our precious blood may not be shed
It's important to the poet that we do not die a shameful, dishonorable death - tossed onto the trash heap of life and looked upon as useless refuse - mocked by those who have attacked us.
The essence of Claude McKay's message is that our blood be not "shed in vain". If we die standing up for what is right in that aforementioned noble cause then even our enemies may relent and honor us for our bravery, courage and convictions, despite their hatred for our way of life and the ideals we hold precious. It certainly is a tall order to stand up for one's principles and die this way - but that is the ideal that the poet is talking about.
In essence, McKay is saying that if the ideal is worth fighting for, then we should fight. With resolve we should face our accusers and enemies and not wither before them as we try to uphold the ideal we are fighting for. He says that those who attack us wrongfully are the actual cowards and we must face them head on and even if we are waning in the attack and on the cusp of death, we must continue the good fight until our death.