Electrocardiogram (ECG) signal is a measure of the heart's electrical activity. Recently, ECG detection and classification have benefited from the use of computer-aided systems by cardiologists. The goal of this paper is to improve the accuracy of ECG classification by combining the Dipper Throated Optimization (DTO) and Differential Evolution Algorithm (DEA) into a unified algorithm to optimize the hyperparameters of neural network (NN) for boosting the ECG classification accuracy. In addition, we proposed a new feature selection method for selecting the significant feature that can improve the overall performance. To prove the superiority of the proposed approach, several experiments were conducted to compare the results achieved by the proposed approach and other competing approaches. Moreover, statistical analysis is performed to study the significance and stability of the proposed approach using Wilcoxon and ANOVA tests. Experimental results confirmed the superiority and effectiveness of the proposed approach. The classification accuracy achieved by the proposed approach is (99.98%).