1. A surface inspection apparatus comprising; an illuminating device that illuminates a test piece having a plurality of repetitive patterns with different pitches formed at a surface thereof; an image-capturing device that captures an object image based upon diffracted light originating from the test piece; a condition control device that sets or changes apparatus an condition under which an object image is captured with said image-capturing device; and a condition determining device that takes in object images, each captured by said image-capturing device every time said apparatus condition is changed by said condition control device and determines an optimal setting for the apparatus condition for inspecting the patterns based upon the images, wherein: said condition determining device takes in object images based upon diffracted light fluxes from the plurality of repetitive patterns with different pitches and determines the optimal setting for the apparatus condition for each of the repetitive patterns.