The present invention relates to a class of fatty acid compounds, a preparation method thereof and use thereof. The fatty acid compounds have the structure of the formula I, which has the ability to activate APMK and inhibit the glucose output in mouse primary hepatocytes. The fatty acid compounds can be used in preparing a medicament for the treatment of obesity or diabetes.