Nearest Neighbor (k-NN), and random forest (RF) classifiers are used to classify liver diseases. Experimental analysis is performed on clinical CT images datasets, which include normal liver, fatty liver, metastasis, cirrhosis, and cancerous samples. The optimal features selected using the WOA-SA improve the accuracy of CLD classification for the five classes of diseases mentioned above. The accuracy of the liver classification using ensemble classifier yields approximately 98% with a 95% confidence interval (CI) of (0.7789, 1.0000) and an error rate of 1.9%. The performance of the proposed method is compared with two existing algorithms and the sensitivity and specificity yield an overall average of 96% and 93%, with 95% confidence interval of (0.7513, 1.0000) and (0.7126, 1.0000), respectively. Classification of CLD based on ensemble classifier illustrates the effectiveness of the proposed method and the comparison analysis demonstrates the superiority of the methodology.