Sand dunes significantly impact climate, water resources, and human infrastructure, reflecting sand sources and wind conditions. However, their complex and heterogeneous terrain leads to fragmented and poorly continuous dune extraction results. Focusing on the Badain Jaran Desert, this study developed a sand dune extraction method using slope cost distance analysis with FABDEM data. First, positive and negative terrains were segmented using 30 m resolution digital elevation data. Next, slope patches were classified based on specific criteria: slope less than 1.5°, patch area greater than 0.01 km2, and patches entirely within negative terrains. The filtered patches served as source data, and slope raster data were used to calculate slope cost distance. Sand dunes and interdune areas were delineated based on a predefined slope cost threshold. Post-processing, such as smoothing and vector conversion, yielded the final extraction results. The method effectively extracted compound transverse megadunes and pyramid megadunes, addressing misclassification issues and accurately defining interdune areas. It demonstrated faster processing speeds compared to traditional methods, with high precision (89.38 % & 90.37 %), accuracy (96.5 % & 92.89 %), and recall (94.77 % & 98.63 %). The results are more complete and less fragmented, aiding in the extraction of micro-scale dune features and revealing macro-scale spatial patterns, which are beneficial for studying dune formation, development, and wind dynamics.