The invention belongs to the field of electrochemistry engineering and industry, and particularly to a niobium carbide and tantalum carbide electrode preparation method, wherein a plate, a sheet, foil or a wire of metal niobium or tantalum is adopted, and is subjected to a reaction with carbon, carbon monoxide, an epoxy resin and the like in the protection of gas with a temperature of 600-1200 DEG C so as to obtain a compact niobium carbide and tantalum carbide layer on the outer surface of niobium and tantalum, wherein the internal is the metals such as niobium and tantalum, and the obtained material has the advantages of flexibility, strength and the like of the metal, has the electric conduction niobium carbide and tantalum carbide layer adopted as the strong corrosion resistance layer, and can be used as a dimensionally stable anode used in sulfuric acid, hydrochloric acid, chlor-alkali electrolysis and other electrolytes. The preparation method has advantages of less operation steps, simple process and stable quality, and is especially suitable for preparation of redox flow batteries, secondary batteries, and electrolysis industry electrodes.