The invention discloses a rational number resonant multi-wavelength encoding method of dynamic Q-switching, which includes sequentially connected pump sources, frequency selectors, 1*(n+1) wavelength division multiplexers, parameter conversion media, 1*( n+1) output coupler, n adjustable delayers and n Q-switching devices form n-way feedback parametric oscillation cavity and encoder. In the present invention, under the condition of not changing the cavity length of the oscillator, the stable oscillation of the parametric oscillator can still be realized only by selecting the frequency of the pump light output by the pump source through the frequency selector. In addition, the feedback signal light is divided into n channels of feedback according to different wavelengths, so that n wavelengths oscillate in the oscillation cavity at the same time, thereby obtaining multi-wavelength output. A Q-switching device is added to each of the n channels of feedback in the oscillator cavity. By changing the loss and resonance threshold in each cavity, various modulation waveforms in the time domain are realized, and then the rational number resonance multi-wavelength encoding of dynamic Q-switching is realized.