New York law not just allows, but requires, courts to dismiss criminal complaints "in the interest of justice" if there is "some compelling factor, consideration or circumstance clearly demonstrating that conviction or prosecution of the defendant ... would constitute or result in injustice." (The law provides more general guidelines on this, which you can read for yourself.)
In People v. Federman, decided last week, the court did just that as to the high school principal who was arrested for a obstruction of justice. The police had arrested a student and were trying to take her out the front door. The principal asked that they take her out the back door, "to avoid removing the student through the front entrance in handcuffs while hundreds of students were waiting to enter school through that entrance." When the police refused, the principal apparently tried to block the front entrance, and was then arrested for resisting arrest himself.
The court concludes that because of the defendant's past accomplishments as principal, because the offense wasn't very serious, and because of the principal's laudable motivations ("attempt[ing] to spare the arrested student from embarrassment" and preventing "disruption with the orderly entry of students and the commencement of classes"), further prosecution would indeed result in injustice. An interesting result, under an interesting procedural rule.
Thanks to commenter stanneus for the pointer to the online version of the opinion.