Time‐of‐flight secondary ion mass spectrometry (TOF‐SIMS) is an imaging‐based analytical technique that can characterize the surfaces of biomaterials. We used TOF‐SIMS to identify important metabolites and oncogenic KRAS mutation expressed in human colorectal cancer (CRC). We obtained 540 TOF‐SIMS spectra from 180 tissue samples by scanning cryo‐sections and selected discriminatory molecules using the support vector machine (SVM) algorithm. Each TOF‐SIMS spectrum contained nearly 860,000 ion profiles and hundreds of spectra were analyzed; therefore, reducing the dimensionality of the original data was necessary. We performed principal component analysis after preprocessing the spectral data, and the principal components (20) of each spectrum were used as the inputs of the SVM algorithm using the R package. The performance of the algorithm was evaluated using the receiver operating characteristic (ROC) area under the curve (AUC) (0.9297). Spectral peaks (m/z) corresponding to discriminatory molecules used to classify normal and tumor samples were selected according to p‐value and were assigned to arginine, α‐tocopherol, and fragments of glycerophosphocholine. Pathway analysis using these discriminatory molecules showed that they were involved in gastrointestinal disease and organismal abnormalities. In addition, spectra were classified according to the expression of KRAS somatic mutation, with 0.9921 AUC. Taken together, TOF‐SIMS efficiently and simultaneously screened metabolite biomarkers and performed KRAS genotyping. In addition, a machine learning algorithm was provided as a diagnostic tool applied to spectral data acquired from clinical samples prepared as frozen tissue slides, which are commonly used in a variety of biomedical tests.