Anti-tuberculosis drug-induced liver injury (ATB-DILI) is one of the most common adverse reactions that brings great difficulties to the treatment of tuberculosis. Thus, early identification of individuals at risk for ATB-DILI is urgent. We conducted a prospective cohort study to analyze the urinary metabolic and microbial profiles of patients with ATB-DILI before drug administration. And machine learning method was used to perform prediction model for ATB-DILI based on metabolomics, microbiome and clinical data. A total of 74 new TB patients treated with standard first-line anti-TB treatment regimens were enrolled from West China Hospital of Sichuan University. Only patients with an updated RUCAM score of 6 or more were accepted in this study. Nontargeted metabolomics and microbiome analyses were performed on urine samples prior to anti-tuberculosis drug ingestion to screen the differential metabolites and microbes between the ATB-DILI group and the non-ATB-DILI group. Integrating electronic medical records, metabolomics, and microbiome data, four machine learning methods was used, including random forest algorithm, artificial neural network, support vector machine with the linear kernel and radial basis function kernel. Of all included patients, 69 patients completed follow-up, with 16 (23.19%) patients developing ATB-DILI after antituberculosis treatment. Finally, 14 ATB-DILI patients and 30 age- and sex-matched non-ATB-DILI patients were subjected to urinary metabolomic and microbiome analysis. A total of 28 major differential metabolites were screened out, involving bile secretion, nicotinate and nicotinamide metabolism, tryptophan metabolism, ABC transporters, etc. Negativicoccus and Actinotignum were upregulated in the ATB-DILI group. Multivariate analysis also showed significant metabolic and microbial differences between the non-ATB-DILI and severe ATB-DILI groups. Finally, the four models showed high accuracy in predicting ATB-DILI, with the area under the curve of more than 0.85 for the training set and 1 for the validation set. This study characterized the metabolic and microbial profile of ATB-DILI risk individuals before drug ingestion for the first time. Metabolomic and microbiome characteristics in patient urine before anti-tuberculosis drug ingestion may predict the risk of liver injury after ingesting anti-tuberculosis drugs. Machine learning algorithms provides a new way to predict the occurrence of ATB-DILI among tuberculosis patients.