To evaluate the comparative risk of incident and recurrent acute anterior uveitis (AAU) across different biological disease-modifying anti-rheumatic drugs (bDMARDs) in patients with ankylosing spondylitis (AS). A retrospective nationwide cohort study was conducted on 34 621 patients with AS without a previous history of AAU using a national claims database. Patients were followed-up from 2010 to 2021. The comparative risk of incident and recurrent AAU across different bDMARDs was examined using multivariable time-dependent Cox models and counting process (AG) models, respectively. The adjusted hazard ratios (aHRs) and 95% confidence intervals (CIs) for incident AAU (bDMARDs non-exposure as reference) were: adalimumab 0.674 (0.581-0.891), etanercept 1.760 (1.540-2.012), golimumab 0.771 (0.620-0.959), infliximab 0.891 (0.741-1.071), and secukinumab 1.324 (0.794-2.209). Compared with adalimumab exposure, etanercept (aHR = 2.553 [2.114-3.083]), infliximab (aHR = 1.303 [1.039-1.634]), and secukinumab exposures (aHR = 2.173 [1.273-3.710]) showed a higher risk of incident AAU. The aHRs and 95% CIs for recurrent AAU (bDMARDs non-exposure as reference) were: adalimumab 0.798 (0.659-0.968), etanercept 1.416 (1.185-1.693), golimumab 0.874 (0.645-1.185), infliximab 0.926 (0.729-1.177), and secukinumab 1.257 (0.670-2.359). Compared with adalimumab exposure, etanercept exposure (aHR = 1.793 [1.403-2.292]) was associated with a higher risk of recurrent AAU. Our data suggest preference for bDMARDs in the following order: adalimumab/golimumab > infliximab > secukinumab > etanercept (for incident AAU prevention) and adalimumab > golimumab/infliximab/secukinumab > etanercept (for recurrent AAU prevention).