Intestinal flora metabolites are the metabolites of flora microorganisms that live symbiotically with humans and are present in large numbers in the human intestine. In recent years, trimethylamine oxide (TMAO), a product related to human intestinal metabolism, has gradually attracted the attention of medical researchers, and many studies have confirmed the relevance of this substance to human cardiovascular disease, chronic kidney disease, diabetes, cancer, etc. The existing methods for the determination of TMAO include Reynolds colorimetric method, picric acid colorimetric method and ion chromatography, but these testing methods have problems such as low sensitivity, high cost, and inapplicability, which cannot meet the practical needs. Therefore, a molecularly imprinted electrochemical sensor was prepared for TMAO detection in this work. The imprinted polymer-modified electrode exhibited high recognition ability for TMAO compared to the non-imprinted polymer carbon paste electrode. The sensor was also successfully used for the sensing of TMAO in urine and swage.