Patients undergoing painless egg retrieval are prone to preoperative anxiety, and whether preoperative anxiety induces postoperative nausea and vomiting (PONV) is debated. The primary objective of this prospective, randomized, controlled study was to compare the clinical effect of ondansetron in preventing PONV for patients with and without preoperative anxiety. The secondary objective was to investigate whether preoperative anxiety was associated with PONV. The self-rating anxiety scale (SAS) was used to assess the anxiety patients undergoing painless egg retrieval. Patients with a SAS standard score of 50-60 were selected to the anxiety group (n=105); and patients with a SAS standard score of 25-35 were assigned to the non-anxiety group (n=104). Venous blood samples of both groups of patients were obtained during admission and 1 hour after surgery, and all serotonin (5-HT) levels were tested using an enzyme-linked immunosorbent assay. The anxiety group was then randomly assigned into two subgroups: ondansetron (AO group, n=53) and placebo saline (AS group, n=52). Similarly, patients in the non-anxiety group were also randomly assigned to one of two subgroups: ondansetron (NO group, n=51) and placebo saline (NS group, n=53). The AO and NO groups received 8 mg (4 mL) of intravenous ondansetron 15 minutes before surgery, while the AS and NS groups received an equivalent volume (4 mL) of normal saline. We then analyzed the vital signs, risk factors for nausea and vomiting, intraoperative anesthetic doses, incidences of nausea and vomiting in 24 hours after surgery, serum 5-HT level before and after surgery, other adverse responses, pain scores, and satisfaction. A total of 200 patients eventually completed this study. The serum 5-HT values in the anxiety group were higher before and after surgery than in the non-anxiety group (P<0.05), but there was no significant difference in serum 5-HT before and after surgery in the same group (P>0.05). The incidence of PONV was more significant in the AS group than in the NS group (P<0.05). The incidence of PONV was also higher in the AS group than in the AO group (P<0.05). Still, there was no statistically significant difference between the NO and NS groups (P>0.05). There were no significant differences between the four groups in vital signs, risk factors for nausea and vomiting, intraoperative anesthetic doses, other adverse responses and pain scores (P>0.05). Patients in the AS group had lower satisfaction scores than those in the other three groups (P<0.05). Patients experiencing preoperative anxiety have a greater risk of PONV following painless egg retrieval compared to those without preoperative anxiety. Ondansetron can reduce the occurrence of PONV in patients with preoperative anxiety, but it has no discernible preventative effect in non-anxious patients. Chinese Clinical Trial Registry ChiCTR2400079504.