Accumulating evidence suggests that gut microbiota alterations influence brain function and could serve as diagnostic biomarkers and therapeutic targets. The potential of using fecal microbiota signatures to aid autism spectrum disorder (ASD) detection is still not fully explored. Here, we assessed the potential of different levels of microbial markers (taxonomy and genome) in distinguishing children with ASD from age and gender-matched typically developing peers (n = 598, ASD vs TD = 273 vs 325). A combined microbial taxa and metagenome-assembled genome (MAG) markers showed a better performance than either microbial taxa or microbial MAGs alone for detecting ASD. A machine-learning model comprising 5 bacterial taxa and 44 microbial MAG markers (2 viral MAGs and 42 bacterial MAGs) achieved an area under the receiving operator curve (AUROC) of 0.886 in the discovery cohort and 0.734 in an independent validation cohort. Furthermore, the identified biomarkers and predicted ASD risk score also significantly correlated with the core symptoms measured by the Social Responsiveness Scale-2 (SRS-2). The microbiome panel showed a superior classification performance in younger children (≤6 years old) with an AUROC of 0.845 than older children (>6 years). The model was broadly applicable to subjects across genders, with or without gastrointestinal tract symptoms (constipation and diarrhea) and with or without psychiatric comorbidities (attention deficit and hyperactivity disorder and anxiety). This study highlights the potential clinical validity of fecal microbiome to aid in ASD diagnosis and will facilitate studies to understand the association of disturbance of human gut microbiota and ASD symptom severity.