Diseases contribute significantly to mortality rates, with data from the World Health Organization (WHO) indicating that Indonesia faces challenges posed by at least 10 diseases with the highest fatality rates. Among these, heart disease ranks second only to stroke. Recent statistics show a 1.25% increase in deaths attributed to heart or cardiovascular diseases in Indonesia compared to the previous year. Given the substantial impact of heart disease, accurate diagnosis becomes crucial for effective prevention and treatment. Machine learning, particularly classification methods, can be employed in diagnostic activities. Classification involves grouping based on specific characteristics for diagnosis, and various methods, including decision trees, Naive Bayes, Support Vector Machine, and k-NN, are utilized. k-NN, despite its simplicity, faces challenges due to prolonged classification processes caused by using all training data. To address this, the feature selection method, particularly Particle Swarm Optimization (PSO), can be employed to optimize the k-NN algorithm. In the context of heart disease classification, the application of k-NN resulted in an accuracy rate of 60.13%. However, when optimizing k-NN with PSO, the accuracy rate significantly improved to 90.75%, demonstrating the efficacy of this approach in overcoming the limitations of using k-NN alone.