A related switching power supply with an accessory protection function comprises a shell and a front cover, a through hole is formed in the top of the shell, a sleeve plate is fixed in the through hole, a movable groove is formed in the top of the sleeve plate in a penetrating mode, a limiting groove is formed in the inner wall of one side of the movable groove, and a limiting block is slidably connected in the limiting groove; a limiting spring is fixedly connected between the limiting block and the inner wall of the limiting groove, a heat removal column is fixedly connected to the inner side of the limiting block, a heat removal groove is formed in one side of the heat removal column, a heat conduction groove is formed in the bottom of the heat removal column and communicates with the heat removal groove, a mounting shaft is rotationally connected to the outlet position of the heat removal groove, and first fan blades are fixedly connected to the top of the mounting shaft; and second fan blades are fixedly connected to the bottom of the mounting shaft, and the edges of the first fan blades and the second fan blades are tangent to the inner wall of the heat removal groove According to the invention, hot air flow emitted during working of components is utilized to push the outlets of the heat removal grooves in the heat removal columns to the upper part of the movable grooves, and the first fan blades and the second fan blades are pushed to rotate, so that the effects of heat dissipation and dust removal are achieved.