To address the challenge of low accuracy in the measurement of laser deep penetration welding depth, this study introduces optical coherence tomography (OCT) technology for the direct measurement of this parameter, which is designed to enable real-time measurement and the accurate acquisition of depth information. This study has developed a laser welding depth inspection system that integrates Spectral-Domain OCT (SD-OCT), utilizing 304 stainless steel as the test material for inspecting laser deep penetration welding. A comparative analysis evaluated the impact of Hierarchical Density-Based Spatial Clustering of Applications with Noise (HDBSCAN), Density-Based Spatial Clustering of Applications with Noise (DBSCAN), and K-means clustering (K-mean) on the clustering of OCT raw data, in addition to the use of percentile filters combined with the exponential moving average method for extracting the depth-of-melt curve. The depth-of-melt curve, obtained via the HDBSCAN algorithm, more accurately reflects the actual depth curve, with an average error remaining below 5%. This error rate is 46% lower than that of DBSCAN and 42% lower than that of K-mean. The results of the experiments with continuously varying process parameters show that a high degree of accuracy can be demonstrated even when the welding process parameters are continuously varied. Experimental results indicate that the combination of the HDBSCAN algorithm with percentile filtering and the exponential moving average method significantly enhances the recognition accuracy of the deep penetration laser welding depth curve. This method provides more precise feature parameters for the real-time detection and identification of defects in deep penetration laser welding, thereby offering strong support for optimizing and controlling the laser welding process.