The American cockroach, Periplaneta americana (L.), is able to highly survive in various complicated environments around the globe, and often considered as a pest. In contrast, billions of P. americana have been massively reared in China and extensively used as a medicinal insect, due to its function for preventing and treating ulceration and heart failure. Considering the possibility that microbiota-derived metabolites could be an effective source to identify promising candidate drugs, we attempted to establish a rapid method for simultaneous determination of gut microbiota metabolites from medicinal insects. In this study, network pharmacology approach and ultra-performance liquid chromatography (UPLC) technique were employed to reveal the potential pharmacological activity and dynamics variation of nitrogen-containing metabolites (NCMs) originated from the gut microbiota of breeding P. americana at different growth stages. A metabolites-targets-diseases network showed that NCMs are likely to treat diseases such as ulceration and cancer. The analysis of NCMs' content with the growth pattern of P. americana indicated that the content of NCMs declined with P. americana aging. Both principal component analysis and orthogonal partial least squares discriminant analysis suggested that 8-hydroxy-2-quinolinecarboxylic acid and 8-hydroxy-3,4-dihydro-2(1H)-quinolinone are the potential differential metabolic markers for discriminating between nymphs and adults of P. americana. Moreover, the developed UPLC method showed an excellent linearity (R2 > 0.999), repeatability (RSD < 2.6%), intra- and inter-day precisions (RSD < 2.2%), and recovery (95.5%–99.0%). Collectively, the study provides a valuable strategy for analyzing gut microbiota metabolites from insects and demonstrates the prospects for discovering novel drug candidates from the feces of P. americana.