In the double-blind, phase III, placebo-controlled RUBY randomized clinical trial, dostarlimab plus carboplatin-paclitaxel significantly increased survival among patients with primary advanced or recurrent endometrial cancer (EC). We conducted a cost-effectiveness analysis of dostarlimab in combination with chemotherapy in these patients stratified by mismatch repair-deficient (dMMR) and mismatch repair-proficient (pMMR) subgroups from the perspective of a United States payer. A Markov model with three states was employed to simulate patients who were administered either dostarlimab in combination with chemotherapy or chemotherapy based on the RUBY trial. Quality-adjusted life-years (QALYs), lifetime costs, and incremental cost-effectiveness ratio (ICER) were calculated with a willingness-to-pay (WTP) threshold of $150,000 per QALY. Both univariate and probabilistic sensitivity analyses were carried out to explore the robustness of the model. In dMMR EC, the combination of dostarlimab and chemotherapy achieved an additional 5.48 QALYs at an incremental cost of $330,747 compared to chemotherapy alone, resulting in an ICER of $60,349.30 per QALY. In pMMR EC, there were 1.51 additional QALYs gained at an extra cost of $265,148, yielding an ICER of $175,788.47 per QALY. With a 15.2% discount on dostarlimab, the ICER decreased to $150,000 per QALY in the pMMR EC. The univariate sensitivity analysis revealed that the cost of dostarlimab, utility of progression-free survival (PFS), and progressive disease (PD) had the most significant impacts on the outcomes. Probabilistic sensitivity analysis revealed that dostarlimab had a 100% likelihood of being considered cost-effective for patients at a WTP threshold of $150,000 per QALY for dMMR EC, whereas this likelihood was only 0.5% for pMMR EC. Dostarlimab in combination with chemotherapy was cost-effective for primary advanced or recurrent dMMR EC from the perspective of a United States payer at a WTP threshold of $150,000 per QALY, but not for pMMR EC. Lowering the prices of dostarlimab could potentially enhance the cost-effectiveness of treatment for pMMR EC.