Early and differential diagnosis of intrahepatic cholangiocarcinoma (iCCA) and hepatocellular carcinoma (HCC) by noninvasive methods represents a current clinical challenge. The analysis of low‐molecular‐weight metabolites by new high‐throughput techniques is a strategy for identifying biomarkers. Here, we have investigated whether serum metabolome can provide useful biomarkers in the diagnosis of iCCA and HCC and could discriminate iCCA from HCC. Because primary sclerosing cholangitis (PSC) is a risk factor for CCA, serum metabolic profiles of PSC and CCA have also been compared. The analysis of the levels of lipids and amino acids in the serum of patients with iCCA, HCC, and PSC and healthy individuals (n = 20/group) showed differential profiles. Several metabolites presented high diagnostic value for iCCA versus control, HCC versus control, and PSC versus control, with areas under the receiver operating characteristic curve (AUC) greater than those found in serum for the nonspecific tumor markers carbohydrate antigen 19‐9 (CA 19‐9) and alpha‐fetoprotein (AFP), commonly used to help in the diagnosis of iCCA and HCC, respectively. The development of an algorithm combining glycine, aspartic acid, SM(42:3), and SM(43:2) permitted to accurately differentiate in the diagnosis of both types of tumors (biopsy‐proven). The proposed model yielded 0.890 AUC, 75% sensitivity, and 90% specificity. Another algorithm by combination of PC(34:3) and histidine accurately permitted to differentiate PSC from iCCA, with an AUC of 0.990, 100% sensitivity, and 70% specificity. These results were validated in independent cohorts of 14‐15 patients per group and compared with profiles found in patients with nonalcoholic fatty liver disease/nonalcoholic steatohepatitis. Conclusion: Specific changes in serum concentrations of certain metabolites are useful to differentiate iCCA from HCC or PSC, and could help in the early diagnosis of these diseases.