The aim of the present study was to determine the analgesic effects of ropivacaine combined with different doses of dexmedetomidine for ultrasound-guided transversus abdominis plane (TAP) block immediately following laparotomy in patients with gynecologic malignancies. A further aim was to determine the appropriate clinical dose of dexmedetomidine as an adjuvant for ropivacaine. Patients with gynecologic malignancies scheduled for laparotomy were randomly assigned to group R (TAP block with 0.3% ropivacaine), group RD1 (TAP block with ropivacaine and 0.5 µg/kg dexmedetomidine), group RD2 (TAP block with ropivacaine and 1 µg/kg dexmedetomidine) and group RD3 (TAP block with ropivacaine and 2 µg/kg dexmedetomidine). TAP blocks were performed post-operatively. The four groups all received patient-controlled intravenous analgesia (PCIA) after the operation. The numerical rating scale (NRS) as well as the Ramsay sedation scale (RSS) scores, the first request time for PCIA bolus, oxycodone hydrochloride consumption, the plasma concentration of ropivacaine, the incidence of post-operative complications and adverse events, and patient satisfaction were recorded. Post-operative NRS scores at rest exhibited significant differences between the R group and all the RD groups at 24 h after surgery (P<0.05). Compared with the other groups, the NRS score in the RD3 group was decreased (P<0.05). The RSS scores were higher in all of the RD groups compared with those in the R group at 2 h (P<0.05) and were highest in the RD3 group compared with those in all other groups at 4 h (P<0.05). The first request time for PCIA was significantly longer in the RD3 group compared with that in the RD2, RD1 and R groups (510.47±102.67, 595.47±100.11, 682.43±104.46 and 776.42±143.91 min, respectively; P<0.05). Cumulative opioid consumption based on the number of PCIA bolus requested at 24 and 48 h post-operatively indicated that the total number of PCIA boluses was significantly lower in the RD groups compared with those in the R group at 24 and 48 h (P<0.05). The ropivacaine concentration did not differ among the four groups. There was no significant difference between groups with respect to post-operative nausea and vomiting, bradycardia and hypotension; however, all RD groups had a higher patient satisfaction than group R (P<0.05). Compared with that in the other groups, the duration of post-anesthesia care unit stay in group RD3 was relatively longer due to excessive sedation (P<0.05). In conclusion, TAP blockade using 0.5-2 µg/kg dexmedetomidine combined with 0.3% ropivacaine is a safe and effective treatment for analgesia in laparotomy procedures for gynecologic malignancies. The study was registered in the Chinese Clinical Trial Registry (CHICTR; www.chictr.org.cn) on January 15th, 2019 (registration no. ChiCTR1900020995).