Praise be to Allah.
The Hanafi, Hanbali and most of the Shaafa'i fuqahaa are agreed that it is OK for a Muslim to leave something to a dhimmi (non-Muslim living under Islamic rule) in his will, and vice versa, so long as this is within the guidelines of shareeah. Their evidence for this is the aayah (interpretation of the meaning): Allaah does not forbid you to deal justly and kindly with those who fought not against you on account of religion and did not drive you out of your homes. Verily, Allaah loves those who deal with equity. [al-Mumtahinah 60:8]. Also, being a kaafir does not disqualify a person from ownership, and as it is OK to sell to a kaafir or give him a gift, it is also OK to include him in ones will.
Some of the Shaafais think that it is OK only if a specific person is named, such as saying I leave [such and such] to so and so; but if a person says I leave [it] to the Jews and Christians, this is not OK because it sounds as if he is making their kufr the reason for leaving something to them. The Maalikis agree with others that it is OK for a non-Muslim to leave something to a Muslim. With regard to a Muslim leaving something to a non-Muslim, Ibn al-Qaasim and Ashhab said that it is allowed if it is done for a reason, such as upholding family ties, otherwise it is makrooh, and should not be done at the expense of a Muslim. No one would do such a thing except one whose faith is diseased.(al-Mawsooah al-Fiqhiyyah, 2/312)
Unfortunately, nowadays we see some Muslims, especially those who are living in kaafir countries, leaving huge sums of money to Christian, Jewish or other kaafir organizations, on the basis that these are charitable, educational or humanitarian organizations and so on, but there is no way that Muslims can benefit from this. The only ones who benefit from it are the kuffar, and their hungry oppressed refugee Muslim brothers are left with no h elp or support. This is a sign of weak, diluted faith and of allegiance to and admiration of the kuffaar and their disbelieving societies. We ask Allaah to keep us safe and sound. May Allaah bless our Prophet Muhammad.