How to determine which pages are color and which are monochrome?
First, you need to decide what makes the page a color page. Probably, monochrome page has zero density of CMY components. To check this using Ghostscript you need to select a true color CMYK device, install correct CRD and rasterize the file. The page is a color page if any pixel has non-zero components in CMY planes.