Extended-spectrum β-lactamase (ESBL) production among Enterobacteriaceae, such as E. coli, has been increasing worldwide, which causes treatment failure for urinary tract infections. Therefore, this study aimed to determine the prevalence and risk factors for the production of ESBL in E. coli from patients with urinary tract infections (UTI) in Zanzibar. a prospective cross-sectional study was conducted from January 2018 to December 2021 in Zanzibar. Data were retrieved from a routine bacteriological laboratory culture report from urine samples of 4306 patients at the Lancet Laboratory. In addition, the patient's social demographics and clinical data were retrieved by examining the medical records in the respective hospitals. All inpatients older than fifteen years diagnosed with urinary tract infections (UTI) and requested urine culture and sensitivity were included. The Chi-square and Fischer's exact tests were used to compare antibiotic resistance. In addition, a binary logistic regression analysis was used to predict ESBL production risk factors. the prevalence of E. coli-producing ESBL was 13.4% (578/4030). Infection of ESBL. E. coli was prevalent in females 52.6% (n=304) compared to male patients, 47.4% (n=274), and the majority 38.8% (n=224), were people of young age, between 16-30 years. The average age of patients was 31.5±10.2 years, with minimum age of 16 years and a maximum age of 72 years. In multivariate analysis, results shown that previously hospitalised patients aOR: 6.35, 95% Cl 3.37-11.92; p=0.001, long hospital stays aOR: 10.34, 95% Cl 3.03-22.29; p <0.001, prior use of penicillin aOR: 7.78, 95% Cl 2.99-29.11; p < 0.001, and prior use of cephalosporin drugs aOR: 4.64, 95% Cl 2.99-9.96; p=0.001, were strongly associated with the emergence of ESBL-producing E. coli in urinary tract infection patients. ESBL E. coli showed high resistance to amoxicillin 99.5% (n=575), ampicillin 97.8.% (n=570), cotrimazaxole 86.2% (n=344), ceftriaxone 73.7% (n=344), ciprofloxacin 73.2% (n=423), and ceftaxime 59.5% (n=426). There was a less resistance to ampicillin -cloxacillin 44.3% (n=256), gentamicin 22.5% (n=22.5), and norfloxacin 18.9% (n=109) respectively. Isolates were shown to be more susceptible to meropenem at 1.6% (n=9). the overall prevalence of ESBL-producing E. coli is 13.4%. The risk of emergence ESBL was higher in patients with previous history of hospitalisation, long hospital stay, prior use of penicillin and cephalosporin drugs. High level of antimicrobial resistance observed against most commonly used antibiotics in treatment of urinary tract infections. The clinicians should rely on microbiological diagnosis in treatment of UTIs to reduce risk of treatment failure. Further study should be carried out to assess the prevalence and resistance pattern of other uropathogens and other risk factors.