Extracapsular extension (ECE) and seminal vesicle invasion (SVI) are associated with negative oncologic outcomes in patients with prostate cancer. We have developed and validated a machine learning model to more accurately identify patients at risk of these adverse surgical outcomes prior to radical prostatectomy (RP). This study included a cohort of patients diagnosed with prostate cancer and treated with RP and lymph node dissection at a tertiary care medical center from 2010 to 2020. An ensemble model using a base gradient-boosted trees-based machine learning model and isotonic calibrators was trained on 80% of the cohort, with 20% held out for validation. The model uses age at surgery, prostate specific antigen level (PSA) at diagnosis, biopsy Gleason grade group, numbers of positive and negative cores on biopsy, and clinical T-stage (cT) as input variables. Model performance was assessed on the hold-out set using the area under the receiver operating curve (AUC). The full dataset included 18,729 eligible patients. Median PSA at diagnosis was 7.3 ng/mL. Most patients had clinically organ confined disease (cT1 - cT2) with only 136 (0.7%) having cT3. The most common biopsy Gleason grade group was 2 (7,118 or 38% of patients), with Gleason grade 4 in 1,796 (9.6%), and 5 in 1,064 (5.7%) patients. After RP, 11,931 (64%) of patients had organ confined disease, 4,298 (23%) had ECE, and 2,500 (13%) had SVI. When validated on the hold-out set (n = 3,746), the model had AUCs of 0.79 (95%-CI 0.77 - 0.80), 0.67 (0.65 - 0.69), and 0.83 (0.81 - 0.85) for the prediction of organ confined disease, ECE, and SVI, respectively. In conclusion, we have developed a machine learning model that predicts individual patient risk of pathologic T-stage. The model can be used to provide more accurate risk assessments and improve surgical treatment planning. We are currently working on externally validating our results on patients from different institutions.