A rotary electric machine control device that performs drive control on an AC rotary electric machine using an inverter that converts power between DC power and AC power through pulse width modulation based on a carrier frequency, the rotary electric machine control device including: an electronic control unit that is configured to vary the carrier frequency such that the carrier frequency becomes higher as a rotational speed of the rotary electric machine becomes higher so that carrier sideband frequencies, which are frequencies of sideband waves that appear on higher and lower sides of a center frequency that is set in accordance with the carrier frequency, are not included in a frequency band prescribed in advance.