Mass spectrometry imaging is a powerful analytical technique for detecting and determining spatial distributions of molecules within a sample. Typically, mass spectrometry imaging is limited to the analysis of thin tissue sections taken from the middle of a sample. In this work, we present a mass spectrometry imaging method for the detection of compounds produced by bacteria on the outside surface of ant exoskeletons in response to pathogen exposure. Fungus-growing ants have a specialized mutualism with Pseudonocardia, a bacterium that lives on the ants' exoskeletons and helps protect their fungal garden food source from harmful pathogens. The developed method allows for visualization of bacterial-derived compounds on the ant exoskeleton. This method demonstrates the capability to detect compounds that are specifically localized to the bacterial patch on ant exoskeletons, shows good reproducibility across individual ants, and achieves accurate mass measurements within 5 ppm error when using a high-resolution, accurate-mass mass spectrometer.