The invention discloses a method for preparing obeticholic acid, 7-ketolithocholicacid and ursodeoxycholic acid. Cholic acid is used as a raw material for preparing obeticholic acid through selectiveprotection by a 3-alpha-hydroxyl group, selective oxidation of a 7-alpha-hydroxyl group, esterification of a 24th carboxyl group, methanesulfonation of a 12-alpha-hydroxyl group, elimination, hydrolysis, silylation, condensation, hydrolysis, catalytic hydrogenation, carbonyl reduction and other reactions; an intermediate is subjected to catalytic hydrogenation to prepare the 7-ketolithocholicacidand then is reduced to prepare the ursodeoxycholic acid. The method provided by the invention uses cheap cholic acid as the raw material, and has advantages of novel synthesis method, low cost, high yield, mild reaction condition, high simplicity in operation, environmental friendliness and high convenience in industrial production.