We present a systematic study of the effect of metallicity on the stellar spectral energy distribution (SED) of O main sequence (dwarf) stars, focussing on the hydrogen and helium ionizing continua, and on the optical and near-IR lines used for spectral classification. The spectra are based on non-LTE line blanketed atmosphere models with stellar winds calculated using the CMFGEN code of Hillier & Miller (1998). We draw the following conclusions. First, we find that the total number of Lyman photons emitted is almost independent of line blanketing effects and metallicity for a given effective temperature. This is because the flux that is blocked by the forest of metal lines at wavelengths shorter than 600 Angstrom is redistributed mainly within the Lyman continuum. Second, the spectral type, as defined by the ratio of the equivalent widths of HeI 4471 Angstrom and HeII 4542 Angstrom, is shown to depend noticeably on the microturbulent velocity in the atmosphere, on metallicity and, within the luminosity class of dwarfs, on gravity. Third, we confirm the decrease in the effective temperature for a given spectral type due to the inclusion of line blanketing recently found by e.g. Martins et al. (2002). Finally, we find that the SED below ~450 Angstrom is highly dependent on metallicity. This is reflected in the behaviour of nebular fine-structure line ratios such as [NeIII]/[NeII] 15.5/12.8 and [ArIII]/[ArII] 9.0/7.0 micron. This dependence complicates the use of these nebular ratios as diagnostic tools for the effective temperature determination of the ionizing stars in HII regions and for age dating of starburst regions in galaxies.