Background China has one of the highest rates of antibiotic resistance worldwide. Existing studies document high rates of antibiotic prescription by primary care providers, especially in rural areas, but there has been little research on clinically inappropriate use of antibiotics, and its drivers. In this study, we used direct measures of clinically inappropriate antibiotic prescriptions to document the degree of overprescription among primary care providers in rural China and to analyse the extent of overprescription attributable to deficits in provider diagnostic and therapeutic knowledge. The prescription rates in the USP interactions and the two vignettes enabled us to assess the amount of over-prescription attributable to deficits in diagnostic knowledge, therapeutic knowledge, and factors that lead providers to deviate from their knowledge of best practice and vignettes. Methods To assess clinically inappropriate antibiotic prescriptions among rural primary care providers, we used 63 unannounced standardised patients (USPs) who visited 442 providers in 207 township health centres and 132 village clinics in rural China. These facilities were randomly sampled from 21 counties in each prefecture in three provinces located in western, central and eastern China. The USPs presented three fixed disease cases, none of which indicated antibiotics. The providers also completed two types of matching vignettes. The first tested the providers' diagnostic and therapeutic knowledge (they were asked to diagnose a disease and suggest a treatment). The second tested their therapeutic knowledge (the correct diagnosis was revealed and the providers were asked to suggest a treatment). Approvals were obtained from the institutional review boards of Stanford University, USA (protocol number 25904) and Sichuan University, China (protocol number K2015025). Informed verbal consent was obtained from all providers participating in the study. To minimise the effect of prior knowledge on the study, both institutional review boards approved a procedure whereby providers consented to USP visits at any time within a 6-month period. Consent from the providers was obtained during a facility survey approximately 5 weeks before visits by USPs. All individuals who participated as USPs were trained to avoid any invasive tests or procedures. Findings Overall, antibiotics were inappropriately prescribed in 221 out of 526 (42%) USP cases. In the matching clinical vignettes, 158 of 525 (30%) providers prescribed antibiotics, which was 29% (p$<$0$·$0001) lower than the prescription rates in the USP interactions. Compared to vignettes assessing diagnostic and therapeutic knowledge jointly, prescription rates were 67% lower in vignettes used to test therapeutic knowledge, in which the diagnosis was revealed (30% vs 10%, p$<$0$·$0001). In the case of both USP interactions and vignettes, providers who asked more clinically appropriate questions or carried out more relevant clinical examinations were less likely to prescribe antibiotics. Interpretation Clinically inappropriate antibiotic prescriptions are common among primary care providers in rural China. Deficits in providers' diagnostic skills and diagnostic uncertainty are major drivers of clinically inappropriate antibiotic prescriptions. Insufficient knowledge of therapeutics plays a minor role. Funding The authors are supported by the 111 Project (number B16031), the Laboratory of Modern Teaching Technology of the Ministry of Education, Shaanxi Normal University, the National Natural Science Foundation of China (numbers 71703083 and 71703084), the National Social Science Fund Youth Project (number 15CJL005), and the Knowledge for Change program at The World Bank (number 7172469).