If twenty-five freeholders in any town or village shall present to a justice of the supreme court of the judicial district in which such town or village is situated, an affidavit, stating that they are freeholders and have paid taxes on real property within such town or village within one year, that they have reason to believe that the moneys of such town or village are being unlawfully or corruptly expended, and the grounds of their belief, such justice, upon ten days' notice to the supervisor, and the officers of the town disbursing the funds to which such moneys belong, or the trustees and treasurer of the village, shall make a summary investigation into the financial affairs of such town or village, and the accounts of such officers, and, in his discretion, may appoint experts to make such investigation, and may cause the result thereof to be published in such manner as he may deem proper.
The costs incurred in such investigation shall be taxed by the justice, and paid, upon his order, by the officers whose expenditures are investigated, if the facts in such affidavit be substantially proved, and otherwise, by the freeholders making such affidavit. If such justice shall be satisfied that any of the moneys of such town or village are being unlawfully or corruptly expended, or are being appropriated for purposes to which they are not properly applicable, or are improvidently squandered or wasted, he shall forthwith grant an order restraining such unlawful or corrupt expenditure, or such other improper use of such moneys.
N.Y. Gen. Mun. Law § 4