Cucumber is grown, as a cash crop besides it is one of the main and popular vegetables in Bangladesh. As Bangladesh's economy is largely dependent on the agricultural sector, cucumber farming could make economic and productivity growth more sustainable. But many diseases diminish the situation of cucumber. Early detection of disease can help to stop disease from spreading to other healthy plants and also accurate identifying the disease will help to reduce crop losses through specific treatments. In this paper, we have presented two approaches namely traditional machine learning (ML) and CNN-based transfer learning. Then we have compared the performance of the applied techniques to find out the most appropriate techniques for recognizing cucumber diseases. In our ML approach, the system involves five steps. After collecting the image, pre-processing is done by resizing, filtering, and contrast-enhancing. Then we have compared various ML algorithms using k-means based image segmentation after extracted 10 relevant features. Random forest gives the best accuracy with 89.93% in the traditional ML approach. We also studied and applied CNN-based transfer learning to investigate the further improvement of recognition performance. Lastly, a comparison among various transfer learning models such as InceptionV3, MobileNetV2, and VGG16 has been performed. Between these two approaches, MobileNetV2 achieves the highest accuracy with 93.23%.