N.Y. CPL. LAW § 170.30 : NY Code - Section 170.30: Motion to dismiss information, simplified information, prosecutor's information or misdemeanor complaint

1.  After arraignment upon an information, a simplified information, a
  prosecutor's information or a misdemeanor complaint, the local  criminal
  court  may, upon motion of the defendant, dismiss such instrument or any
  count thereof upon the ground that:
    (a)  It is defective, within the meaning of section 170.35; or
    (b)   The defendant has received immunity  from  prosecution  for  the
  offense charged, pursuant to sections 50.20 or 190.40; or
    (c)    The  prosecution is barred by reason of a previous prosecution,
  pursuant to section 40.20; or
    (d)  The prosecution is untimely, pursuant to section 30.10; or
    (e)  The defendant has been denied the right to a speedy trial; or
    (f)  There exists some other jurisdictional  or  legal  impediment  to
  conviction of the defendant for the offense charged; or
    (g)    Dismissal  is  required  in  furtherance of justice, within the
  meaning of section 170.40.
    2.  A motion pursuant to this section, except  a  motion  pursuant  to
  paragraph  (e)  of  subdivision  one,  should  be made within the period
  provided by section 255.20.  A motion made pursuant to paragraph (e)  of
  subdivision  one  should  be  made prior to the commencement of trial or
  entry of a plea of guilty.
    3.  Upon the motion, a defendant who is in a  position  adequately  to
  raise  more  than  one ground in support thereof should raise every such
  ground upon which he intends to challenge the accusatory instrument.   A
  subsequent  motion  based  upon  such  a  ground  not  so  raised may be
  summarily denied, although the court, in the interest of justice and for
  good cause shown, may in its discretion entertain and dispose of such  a
  motion on the merits notwithstanding.