Trastuzumab deruxtecan has shown encouraging activity in patients with treatment-refractory HER2-positive, RAS wild-type and BRAF wild-type metastatic colorectal cancer. Dose optimisation and further antitumour assessments in patients with RAS mutations and those with previous anti-HER2 therapy are warranted. We aimed to evaluate two doses of trastuzumab deruxtecan (5·4 mg/kg and 6·4 mg/kg) to establish the recommended dose in patients with pretreated HER2-positive, RAS wild-type or mutant metastatic colorectal cancer. DESTINY-CRC02 was a multicentre, randomised, two-stage, two-arm, phase 2 study done in 53 research hospitals and medical centres in Australia, Belgium, France, Italy, Japan, South Korea, Spain, Taiwan, the UK, and the USA. Eligible patients were aged 18 years and older or 20 years and older (depending on region) with pretreated pathologically documented, unresectable, recurrent, or metastatic HER2-positive, and RAS wild-type or mutant colorectal cancer. Patients were required to have an Eastern Cooperative Oncology Group (ECOG) performance status of 0 or 1 and have received previous chemotherapy, and anti-EGFR, anti-VEGF, or anti-PD-L1 therapy, if clinically indicated. In stage 1, patients were randomly assigned (1:1), via a secure interactive response technology system, to receive 5·4 mg/kg or 6·4 mg/kg trastuzumab deruxtecan administered intravenously every 21 days. Stratification factors were ECOG performance status, HER2 status, and RAS status. In stage 2, patients were assigned into the 5·4 mg/kg treatment group only. The primary endpoint was confirmed objective response rate by blinded independent central review, assessed in all patients for whom treatment was assigned (full analysis set). Safety was assessed in all patients who received at least one dose of study drug. This trial is registered with ClinicalTrials.gov, NCT04744831, and is ongoing (not recruiting). Between March 5, 2021, and March 29, 2022, 135 patients were centrally screened, 122 of whom were enrolled. In stage 1, 40 patients each were randomly assigned to receive trastuzumab deruxtecan 5·4 mg/kg and 6·4 mg/kg. In stage 2, an additional 42 patients were enrolled in the 5·4 mg/kg group. 64 (52%) participants were male and 58 (48%) were female. The median duration of follow-up was 8·9 months (IQR 6·7-10·5) in the 5·4 mg/kg group and 10·3 months (5·9-12·7) in the 6·4 mg/kg group. The confirmed objective response rate by blinded independent central review was 37·8% (31/82 [95% CI 27·3-49·2]) in the 5·4 mg/kg group and 27·5% (11/40 [14·6-43·9]) in the 6·4 mg/kg group. 34 (41%) of 83 patients in the 5·4 mg/kg group and 19 (49%) of 39 in the 6·4 mg/kg group had grade 3 or worse drug-related treatment-emergent adverse events. The most common grade 3 or worse drug-related treatment-emergent adverse events were neutrophil count decreased (13 [16%] of 83 patients), anaemia (six [7%]), nausea (six [7%]), and white blood cell count decreased (five [6%]) in the 5·4 mg/kg group; and were neutrophil count decreased (10 [26%] of 39 patients), anaemia (eight [21%]), platelet count decreased (four [10%]), and white blood cell count decreased (four [10%]) in the 6·4 mg/kg group. Drug-related serious adverse events occurred in 11 (13%) of 83 patients in the 5·4 mg/kg group and six (15%) of 39 patients in the 6·4 mg/kg group; the most common in the 5·4 mg/kg group was nausea (three [4%] patients) and the most common in the 6·4 mg/kg group were fatigue (two [5%] patients), neutropenia (two [5%]), and thrombocytopenia (two [5%]). A drug-related treatment-emergent adverse event related to death occurred in one (1%) patient in the 5·4 mg/kg group (due to hepatic failure). Adjudicated drug-related interstitial lung disease or pneumonitis events were observed in seven (8%) patients in the 5·4 mg/kg group (all grade 1 or 2) and in five (13%) patients in the 6·4 mg/kg group (four grade 1 or 2; one grade 5). The promising antitumour activity and favourable safety profile support trastuzumab deruxtecan 5·4 mg/kg as the optimal single-agent dose for patients with pretreated HER2-positive metastatic colorectal cancer, including those with RAS mutations, previous anti-HER2 therapy, or both. Daiichi Sankyo and AstraZeneca.