This paper introduces a modified soft margin optimal hyperplane (MSMOH) model that integrates the kernel trick for heart disease classification. The optimal hyperparameters for each kernel are determined using particle swarm optimization (PSO), aiming to minimize the difference between desired and achieved test accuracy in a 5-fold cross-validation setup. The performance of MSMOH is compared against a random forest (RF) classifier. Results show that the MSMOH with radial basis function (RBF) kernel achieves the most balanced and accurate performance, outperforming RF and other MSMOH kernels in both accuracy and F1-score. These findings demonstrate the potential of MSMOH as a reliable support vector machine (SVM) variant for medical diagnosis tasks, particularly combined with metaheuristic optimization.