If the money was acquired illegally, then the answer is certainly “no”: it isn’t the donor’s money to give, and by accepting it, the rabbi or congregation is participating in that donor’s act of theft.
Suppose, however, that the money is, as you say, “very badly needed.” Perhaps it is a matter of life and death; does that fact change the equation? Well, yes and no (how’s that for a gutsy answer?). On the one hand, situations that constitute true emergencies are often governed by emergency rules. Saving life (pikuach nefesh) takes priority over almost every other mitzvah or Jewish religious duty. Therefore, we could make a case for using the ill-gotten money to respond to whatever clear and present danger we happen to face. On the other hand, one is not “permitted” to use the property of another in order to save one’s own life. That is, the property does not become legally yours by the mere fact that you face an emergency. Practically speaking, this means that if you do use someone else’s property in order to save your life, you have to compensate the owner after the emergency has passed. If the "emergency" is not a matter of life and death, though, it's hard to see how an individual or community could properly accept the stolen money in the first place.
As a general rule, life saving trumps all concerns, so if it is a matter of life and death, of course the money can be accepted. It is even arguable that the money must be accepted if the alternative is death.
But the debt remains. If it is stolen money, the money used to save life still needs to be returned.
I notice you ask about a Rabbi. Why would a Rabbi be dfferent than anyone else? Everyone is beholden to Jewish law, Rabbi or not.
On the matter of "very badly needed," that is somewhat more complicated. Needs are usually relative, and it is easy for people to justify inappropriate actions by saying that it was as a result of a "very badly needed" circumstance.
Additionally, knowingly accepting money acquired illegally is a clear Hillul haShem, a desecration of God's Name. There is no room for such behavior.
I have dealt with this question at length in a rabbinic ruling (teshuvah) that I wrote for the Conservative Movement’s Committee on Jewish Law and Standards. It is called “Donations of Ill-Gotten Gain,” and one can find it at