Bile acids (BAs) are involved in the development of necrotizing enterocolitis (NEC), which mainly occurs in preterm infants. We aim to identify the change of BAs in preterm infants and validate its potential value in the detection of NEC. Targeted liquid chromatography–tandem mass spectrometry (LC-MS/MS) was performed to measure the plasma BAs in healthy preterm infants and patients with NEC. By analyzing the level of BAs in healthy preterm infants, we found that the plasma concentrations of BAs were related to sex, gestational/postnatal age, birth weight, mode of birth, and feeding type after birth. The plasma levels of TCA, GCA, TCDCA, GCDCA, primary BAs, and total BAs and the primary/secondary BA ratio were decreased, while DCA, UDCA, and secondary BAs were increased in NEC. The primary/secondary BA ratio (cutoff point 62.9) can effectively differentiate NEC from healthy preterm infants, with an AUC of 0.9, a sensitivity of 94.5%, and a specificity of 78.1%. Combining the ratio with high-risk factors of NEC can better distinguish between NEC and control, with an AUC of 0.95. Importantly, significantly lower levels of primary/secondary BA ratio were found in infants with surgical NEC than in nonsurgical NEC cases. The cutoff point of 28.7 identified surgical NEC from nonsurgical NEC with sensitivity and specificity of 76.9% and 100%. Thus, our study identified that the primary/secondary BA ratio in the plasma can differentiate NEC from healthy preterm infants and effectively differentiate the surgical NEC from nonsurgical NEC. Therefore, LC-MS/MS was expected to be a novel measurement platform used to distinguish infants who are most in need of close monitoring or early surgical intervention.