Vacancy engineering is a promising approach for optimizing the energy storage performance of transition metal dichalcogenides (TMDs) due to the unique properties of vacancies in manipulating the electronic structure and active sites. Nevertheless, achieving effective introduction of anion vacancies with adjustable vacancy concentration on a large scale is still a big challenge. Herein, MoS2(1-x)Se2x alloys with anion vacancies introduced in situ have been achieved by a simple alloying reaction, and the vacancy concentration has been optimized through adjusting the chemical composition. Experimental and density functional theory calculation results suggest that the anion vacancies in MoS2(1-x)Se2x alloys could enhance the electronic conductivity, induce more active sites, and alleviate structural variation in the alloys during the potassium storage process. When applied as potassium ion battery anodes, the most optimized vacancy-rich MoSSe alloy delivered high reversible capacities of 517.4 and 362.4 mAh g-1 at 100 and 1000 mA g-1, respectively. Moreover, a reversible capacity of 220.5 mAh g-1 could be maintained at 2000 mA g-1 after 1000 cycles. This work demonstrates a practical approach to modifying the electronic and defect properties of TMDs, providing an effective strategy for constructing advanced electrode materials for battery systems.