Abstract Civet coffee, or kopi luwak, has attracted significant attention within the coffee industry in certain regions due to its distinct flavor characteristics that arise from the digestive processes of the civet. The ability to discriminate between wild and feeding civet coffee is of major importance in upholding the industry’s established standards of quality and transparency. This study introduces an innovative method to differentiate between these two coffee types using Headspace Gas Chromatography-Mass Spectrometry (HS-GCMS) with advanced data analysis using machine-learning techniques. This study encompasses seven samples collected from various regions, all of which were subjected to analysis in both roasted and unroasted forms. The data analysis consisted of Principal Component Analysis (PCA) and Hierarchical Cluster Analysis (HCA), which revealed clear trends that were mostly influenced by processing, indicating how roasting affects the chemical profiles of various coffee types. Further classification was conducted using Support Vector Machine (SVM) and Random Forest (RF) machine learning algorithms. SVM exhibited notable accuracy at 90%, effectively discriminating between wild and feeding civet coffee, whereas RF outperformed it with a remarkable 100% accuracy. This study contributes to the field of coffee characterization by presenting a robust approach to discriminate between roasted and unroasted wild and feeding civet coffee. This tool serves as a starting step for a valuable resource for both farmers and customers, as it promotes sustainable and ethical practices while retaining the distinct flavor characteristics of this exceptional specialty coffee.