(iv) Such merit time allowance may be granted when an inmate successfully participates in the work and treatment program assigned pursuant to section
eight hundred five of this article and when such inmate obtains a general equivalency diploma, an alcohol and substance abuse treatment certificate, a vocational trade certificate following at least six months of vocational programming or performs at least four hundred hours of service as part of a community work crew.
Such allowance shall be withheld for any serious disciplinary infraction or upon a judicial determination that the person, while an inmate, commenced or continued a civil action, proceeding or claim that was found to be frivolous as defined in subdivision (c) of section eight thousand three hundred three-a of the civil practice law and rules, or an order of a federal court pursuant to rule 11 of the federal rules of civil procedure imposing sanctions in an action commenced by a person, while an inmate, against a state agency, officer or employee.