Composting is an efficient way to convert organic waste into fertilizers. However, waste materials often contain large amounts of antibiotic resistance genes (ARGs) and mobile genetic elements (MGEs) that can reduce the efficacy of antibiotic treatments when transmitted to humans. Because conventional composting often fails to remove these compounds, we evaluated if hyperthermophilic composting with elevated temperature is more efficient at removing ARGs and MGEs and explored the underlying mechanisms of ARG removal of the two composting methods. We found that hyperthermophilic composting removed ARGs and MGEs more efficiently than conventional composting (89% and 49%, respectively). Furthermore, the half-lives of ARGs and MGEs were lower in hyperthermophilic compositing compared to conventional composting (67% and 58%, respectively). More-efficient removal of ARGs and MGEs was associated with a higher reduction in bacterial abundance and diversity of potential ARG hosts. Partial least-squares path modeling suggested that reduction of MGEs played a key role in ARG removal in hyperthermophilic composting, while ARG reduction was mainly driven by changes in bacterial community composition under conventional composting. Together these results suggest that hyperthermophilic composting can significantly enhance the removal of ARGs and MGEs and that the mechanisms of ARG and MGE removal can depend on composting temperature.