A nontarget screening method was developed based on D‐optimal designs for ultra‐high performance supercritical fluid chromatography with positive and negative electrospray ionization mode mass spectrometry. A mixture of organic contaminants such as pesticides, steroids, surfactants, phenolic and fatty acids, and polycyclic aromatic hydrocarbon derivatives, was used for the optimization. An aprotic mixture of dichloromethane and acetone [3:1] performed overall best as the injection solvent. The highest peak capacities (n) were accomplished at the shallowest gradient (1%B/min), ammonium formate (n = 378 in negative ionization mode), or ammonium acetate (n = 327 in positive ionization mode) in methanol as the modifier. Capillary voltage, make‐up solvent flow rate, water, and additive concentration were the most significant factors for improving peak intensity: higher peak intensities were obtained at lower additive concentrations (5mM ammonium formate), and with 5% water in positive ionization mode. Conversely, water had detrimental effects in negative ionization mode. The optimized method was used to quantify organic contaminants in 17 freshwater sediment samples from Copenhagen, Denmark. Out of 50 monitored contaminants, 35 were detected in at least one sample. Further, the method has a potential for target and nontarget screening analysis of organic contaminants in solid matrices.