Photonics crystal sensors, sensitive to light, play a crucial role in discerning minute alterations in a material's refractive index, finding widespread application, such as in monitoring drinking water quality. Our objective is to fashion a sensor based on a 2D photonics crystal structure and scrutinize optical transformations induced by variations in the bacteria's refractive index as light traverses the sensor structure. Leveraging Rsoft's simulation capabilities, we assessed transmission spectra, observing shifts in the bacteria's refractive index and their consequential impact on the light signal's frequency and wavelength within the sensor structure. The simulations unequivocally demonstrate that fluctuations in the bacteria's refractive index significantly affect the light signal's frequency and wavelength. Consequently, the study underscores the efficacy of the Rsoft-designed optical sensor in discerning bacterial presence in contaminated water, achieving an average sensitivity of 834.344 nm/RIU. In conclusion, the study establishes the success of the optical sensor crafted with Rsoft software in detecting bacteria in polluted water. By monitoring optical alterations during light traversal, variations in the bacteria's refractive index are translated into discernible shifts in the light signal's frequency and wavelength, facilitating effective bacteria detection.