The invention discloses a cobalt-iron bimetallic nitride composite electrocatalyst and a preparation method thereof. The electrocatalyst comprises the components by the mass percentage: 20-52% of ironnitride, 44-26% of cobalt nitride and the balance being carbon cloth. The preparation method comprises the steps: refluxing carbon cloth with concentrated nitric acid, cleaning and drying; preparinga cobalt nitrate aqueous solution, adding the cobalt nitrate aqueous solution into a prepared 2-methylimidazole aqueous solution, uniformly stirring and mixing, adding the treated carbon cloth into the obtained mixed solution, carrying out a reaction at room temperature, cleaning and drying to obtain a ZIF-67/carbon cloth composite material; adding the ZIF-67/carbon cloth composite material into aprepared potassium ferrocyanide aqueous solution, carrying out a reaction at room temperature, cleaning and drying, calcining, and cooling to room temperature to obtain the iron nitride/cobalt nitride/carbon cloth composite material. The prepared electrocatalyst can greatly reduce overpotential and Tafel slope, has good electrical conductivity, and can greatly improve the water decomposition andcatalytic oxygen production efficiency of the composite electrocatalyst.