Plasmids play a critical role in rapid bacterial adaptation by encoding accessory functions that may increase the host's fitness. However, the diversity and ecology of plasmids is poorly understood due to computational and experimental challenges in plasmid identification. Here, we report the Plasmid Classification System (PCS), a machine learning classifier that recognizes plasmid sequences based on gene functions. To train PCS, we performed a large-scale discovery and comparison of gene functions in a reference set of >16,000 plasmids and >14,000 chromosomes. PCS accurately recognizes a diverse range of plasmid subtypes, and it outperforms the previous state-of-the-art approach based on k-mer decomposition of sequences. Armed with this model, we conducted, to our knowledge, the largest search for naturally occurring human gut plasmids in 406 publicly available metagenomes representing 5 countries. This search yielded 6,257 high-confidence predicted plasmids, of which 576 had evidence of a circular conformation based on pair-end mapping. These predicted plasmids were found to be highly prevalent across the metagenomes compared to the reference set of known plasmids, suggesting there is extensive and uncharacterized plasmid diversity in the human gut microbiome.