Mode-converting longitudinal corrugations are used as a means of improving the selectivity properties of cavities for second-harmonic gyrotrons. As an example, 100-kW 0.3-THz second-harmonic gyrotron is considered. For the operating second-harmonic mode and most dangerous first-harmonic competing modes, the eigenvalues, ohmic losses and beam-wave coupling coefficients are investigated with respect to dimensions of a corrugated cavity. The most optimal parameters are found for a gyrotron cavity with mode-converting corrugations, which ensure the widest range of a single mode operation for the 0.3-THz second-harmonic gyrotron. It is shown that, in this range, the gyrotron output power can be increased up to 180 kW. It is found that output mode purity of the 0.3-THz second-harmonic gyrotron falls off due to mode-converting corrugations, which induce undesirable coupling of the operating mode with neighboring Bloch harmonics in the output section of the gyrotron cavity.