The detection of foodborne bacteria is critical in ensuring both consumer safety and food safety. If these pathogens are not properly identified, it can lead to dangerous cross-contamination. One of the most common methods for classifying bacteria is through the examination of Hyperspectral microscope imaging (HMI). A widely used technique for measuring microbial growth is microscopic cell counting. HMI is a laborious and expensive process, producing voluminous data and needing specialized equipment, which might not be widely available. Machine learning (ML) methods are now frequently utilized to automatically interpret data from hyperspectral microscopy. The objective of our study is to devise a technique that employs deep transfer learning to address the challenge of limited data and utilizes four base classifiers - InceptionResNetV2, MobileNet, ResNet101V2, and Xception - to create an ensemble-based classification model for distinguishing live and dead bacterial cells of six pathogenic strains. In order to determine the optimal weights for the base classifiers, a Powell's optimization method was utilized in conjunction with a weighted average ensemble (WAVE) technique. We carried out an extensive experimental study to verify the efficiency of our proposed ensemble model on live and dead cell images of six different foodborne bacteria. In order to gain a better understanding of the regions, we performed a Grad-CAM analysis to explain the predictions made by our model. Through a series of experiments, our proposed framework has proven its capacity to effectively and precisely detect numerous bacterial pathogens. Specifically, it achieved a perfect identification rate of 100% for Escherichia coli (EC), Listeria innocua (LI), and Salmonella Enteritidis (SE), while achieving rates of 96.30% for Salmonella Typhimurium (ST), 87.13% for Staphylococcus aureus (SA), and 94.12% for Salmonella Heidelberg (SH). As a result, it can be considered as an effective tool for the identification of foodborne pathogens, due to its high level of efficiency.