A Manhattan Supreme Court judge has dismissed and sealed the case against an ex-NYPD detective accused of perjury, following allegations of prosecutorial misconduct by the defense.