Am I allowed to buy, from the bank, an old, closed down shul building in NY & develop it into an apartment building?
Yes, it is permitted to buy a shul and develop it. You should try to ensure that the bathrooms should not be designed to be in the area of the main shul.
Although there are types of shuls that cannot be sold, poskim write that these are a rare breed, and in the case of a closed down shul, there is certainly no problem in selling (and buying) it. See Magen Avraham 153:17, Aruch Hashulchan (153:24), Mishnah Berurah (Biur Halachah 153), among others.
However, the kedushah of a shul must be “redeemed,” and this happens when it is sold by the people in charge (with the agreement of the community), or another building built in its place. If the bank is selling the building, there is room to assume that this “redemption” has already taken place, but this cannot be certain.
If the kedushah is “redeemed,” there is no longer any restriction on what can be done. However, because of the uncertainty involved, building a bathroom in the area of the main shul should be avoided.
The history of the shul can be verified, and how it came to the hands of the bank can be verified, and you can ascertain if the kedushah was actually “redeemed” or not.