Rapid detection of pathogens is crucial for controlling pathogenic diseases and improving the quality of food industry. This paper presents a microfluidic platform integrated with optical detection module to rapidly detect Pseudomonas aeruginosa (P. aeruginosa) and Escherichia coli (E. coli). The detection module comprises a microfluidic chip embedded with fiber optics connected to photosensors and a laser source. Initially, the immunomagnetic separation technique was applied to isolate specific pathogens out of testing sample using magnetic particles coated with antibodies. The separated sample containing magnetic beads was loaded into the chip and passed by the monochromatic light in the detection module. The scattered light signals from the passing magnetic beads were collected by the photosensors coupled with fiber optics. The acquired raw data were pre-processed by removing noise and distortions for further analysis. A new calibration model known as the Optical Transformer (OptiTr) structure was used for classification of acquired data. Convolution-based classical model (ResNeXt) was used as baseline comparison. The system provided higher classification results using the OptiTr model for classifying P. aeruginosa and E. coli, with accuracy values of 99.57% and 94.59%, respectively. The blank samples without P. aeruginosa and E. coli showed a classification accuracy of 94.73%. The microfluidic platform has the capability to identify P. aeruginosa and E. coli with a detection limit of 101 CFU/mL. The technique does not require complex sample preparation methods or complicated laboratory tools. The developed technique has a 15-minute detection time with a 40-minute sample preparation duration.