Granulated coconut sugar has been well-known as a sweetener which is more nutritious and has lower glycemic index than cane sugar. Adding cane sugar to coconut sap during heating may result in coconut sugar with an undesirable export quality. The purpose of this study was to develop a novel approach by designing a low-cost portable spectrometer capable of detecting the presence of cane sugar in granulated coconut sugar using machine learning. The AS7265x multispectral sensor chipset is the main component of the proposed LED-based spectrometer. This chipset uses two integrated LEDs as the light source and has 18 channels output ranging from the visible to near-infrared spectrum as the predictor variables to identify the adulteration in granulated coconut sugar. A variety of machine learning techniques were used to determine the purity of granulated coconut sugar as well as the quantity of cane sugar added. Backpropagation neural networks outperformed various machine learning methods, including the support vector machine, k-nearest neighbor, and naïve Bayes methods, in determining the purity of granulated coconut sugar. The developed portable LED-based spectrometer by means of backpropagation neural networks as the classifier can successfully detect adulteration in granulated coconut sugar with very high accuracy level.