A magnetic bearing device, comprising: a magnetic bearing (21, 22) including a plurality of electromagnets (51 to 54) configured to apply electromagnetic force to a shaft connected to a rotary electric machine; a displacement sensor (31, 32) configured to output an output signal in accordance with a displacement of the shaft; and a controller configured to control the electromagnets (51 to 54), wherein the controller compensates for a change in levels of the output signal, the change occurring in accordance with a change in ambient temperature around the displacement sensor (31, 32), based on one or more reference values correlating with the change in levels of the output signal, the one or more reference values being detected for use in controlling the rotary electric machine, a fluid machine system including the rotary electric machine, or an apparatus including the fluid machine system, and the controller controls the electromagnets (51 to 54) based on the compensated output signal for the change in levels of the output signal, wherein the fluid machine system is a compressor provided to a refrigerant circuit, the rotary electric machine is an electric motor for driving the compressor, and the controller uses any one of detection values or a value obtained from a combination of two or more of the detection values as the one or more reference values, the detection values being a rotational speed of the rotary electric machine, a temperature detected in a control board on which a control device for the rotary electric machine is mounted, a refrigerant pressure and a refrigerant flow rate in the refrigerant circuit, and a current value of the rotary electric machine. a magnetic bearing (21, 22) including a plurality of electromagnets (51 to 54) configured to apply electromagnetic force to a shaft connected to a rotary electric machine; a displacement sensor (31, 32) configured to output an output signal in accordance with a displacement of the shaft; and a controller configured to control the electromagnets (51 to 54), wherein the controller compensates for a change in levels of the output signal, the change occurring in accordance with a change in ambient temperature around the displacement sensor (31, 32), based on one or more reference values correlating with the change in levels of the output signal, the one or more reference values being detected for use in controlling the rotary electric machine, a fluid machine system including the rotary electric machine, or an apparatus including the fluid machine system, and the controller controls the electromagnets (51 to 54) based on the compensated output signal for the change in levels of the output signal, wherein the fluid machine system is a compressor provided to a refrigerant circuit, the rotary electric machine is an electric motor for driving the compressor, and the controller uses any one of detection values or a value obtained from a combination of two or more of the detection values as the one or more reference values, the detection values being a rotational speed of the rotary electric machine, a temperature detected in a control board on which a control device for the rotary electric machine is mounted, a refrigerant pressure and a refrigerant flow rate in the refrigerant circuit, and a current value of the rotary electric machine.