The invention relates to a method for preparing an antibacterial compound, in particular to a method for preparing a ceftezole sodium compound. The method comprises the following steps of: 1, synthesizing TZT II, and reacting 2-mercapto-1,3,4 thiadiazole and 7-aminocephalosporanic acid (ACA) to obtain TZT, wherein dimethyl carbonate is used as a reaction solvent; a boron trifluoride-dimethyl carbonate complex is used as a catalyst; after reaction, the agent used by adjusting pH of reaction liquid is sodium carbonate; the weight ratio of boron trifluoride to 7-ACA is 0.7 to 1.3; and 2, synthesizing anhydride I, namely reacting 1H-tetrazole-1-acetic acid and pivaloyl chloride to obtain anhydride; 3, synthesizing ceftezole III, namely reacting TZT II and anhydride I to obtain ceftezole; and 4, synthesizing ceftezole sodium IV, namely reacting ceftezole and sodium salt to obtain ceftezole sodium IV, wherein salt is sodium hydroxide.