We have constructed an ultrahigh vacuum confocal fluorescence microscope with the purpose of performing single molecule spectroscopy under highly defined conditions. The microscope is designed for high stability while affording the capability of sample preparation, sample transfer, and optical detection in ultrahigh vacuum. It achieves near-diffraction-limited performance and allows the observation of single molecule fluorescence dynamics over extended periods of time. The design of the microscope is discussed in detail and the performance is demonstrated with single molecule fluorescence images and trajectories of N,N'-dibutylperylene-3,4,9,10-dicarboxyimide deposited onto several different surfaces. This instrument further enhances the array of available surface science techniques, permitting spectroscopic investigations of molecule-surface interactions at the single molecule level and on insulating surfaces.