Reducing background noise is essential for clear data analysis and signal detection. In this study, we introduce a novel denoising algorithm tailored for gamma-ray astronomical data, utilizing local density sampling techniques. The proposed algorithm preferentially amplifies regions of high local density, which are indicative of potential sources, while diminishing the influence of low-density areas. This selective enhancement significantly bolsters the performance of clustering algorithms in pinpointing point sources, effectively minimizing the interference of high-density noise that could be mistaken for genuine sources. We have implemented this algorithm on Fermi Large Area Telescope data, and our results showcase a marked advancement in the clustering algorithm's capacity to discard false sources.