Over the past decade, sequencing data generated by large microbiome projects showed that taxa exhibit patchy geographical distribution, raising questions about the geospatial dynamics that shape natural microbiomes and the spread of antimicrobial resistance (AMR) genes. Answering these questions requires distinguishing between local and non-local microorganisms and identifying the source sites for the latter. Predicting the source sites and migration routes of microbiota has been envisioned for decades but was hampered by the lack of data, tools, and understanding of the processes governing biodiversity. State-of-the-art biogeographical tools suffer from low resolution and cannot predict biogeographical patterns at a scale relevant to ecological, medical, or epidemiological applications. Analyzing urban, soil, and marine microorganisms, we found that some taxa exhibit regional-specific composition and abundance, suggesting they can be used as biogeographical biomarkers. We developed the Microbiome Geographic Population Structure (mGPS), a machine-learning-based tool that utilizes microbial relative sequence abundances to yield a fine-scale source site for microorganisms. mGPS predicted the source city for 92% of the samples and the within-city source for 82% of the samples, though they were often only a few hundred meters apart. mGPS also predicted soil and marine sampling sites for 86% and 74% of the samples, respectively. We demonstrated that mGPS differentiated local from non-local microorganisms and used it to trace the global spread of AMR genes. mGPS's ability to localize samples to their waterbody, country, city, and transit stations opens new possibilities in tracing microbiomes and has applications in forensics, medicine, and epidemiology.