The invention discloses a method for generating a microwave frequency comb, which belongs to the technical field of microwave photons. First, inject the DC optical signal with adjustable amplitude into the semiconductor laser, so that the semiconductor laser works in a single-cycle oscillation state; then divide the output optical signal of the semiconductor laser into upper and lower paths, and the upper path undergoes photoelectric conversion, delay, and amplification. As a feedback signal, it is re-modulated to the semiconductor laser to form a photoelectric feedback loop; the downstream optical signal is sent to the photodetector for photoelectric conversion; the amplitude of the DC optical signal is modulated so that the amplitude of the DC optical signal is periodic The linear change of the property, and make the delay of the photoelectric feedback loop be an integer multiple of the linear change period of the amplitude of the DC optical signal. At this time, the output of the down channel photodetector is the microwave frequency comb signal. The invention also discloses a microwave frequency comb generating device. The invention can generate a microwave frequency comb signal with large bandwidth, high and fine comb-tooth spacing, and tunable bandwidth, center frequency and comb-tooth spacing.