Urinary Tract Infection (UTI): A common bacterial infection affecting the urinary system, leading to symptoms like frequent urination, burning sensation, and cloudy bloody urine. Urosepsis: A severe condition caused by untreated UTIs, where the infection spreads to the bloodstream, potentially leading to organ failure and life-threatening complications.Prompt treatment is vital. UTIs and the associated risk of urosepsis represent critical public health concerns. To address this, we present an innovative optical method supported by machine learning, specifically designed for mass screening of UTIs and urosepsis in urine samples. Our study involves obtaining spectra through spectroscopy measurements of artificial urine samples spiked with bacteria from solid cultures of clinical E. coli strains, allowing for the precise differentiation of infections. To ensure reliable classification, we rigorously tested 27 machine learning algorithms, achieving a remarkable accuracy rate of up to 97%.