Fully automated immunoassay analyzers are integral to clinical testing, with liquid-level detection crucial to mitigate false measurements and cross-contamination. This study introduces a bubble detection algorithm based on the Random Forest machine learning model to address bubble detection in analyzers using capacitive sensors. The algorithm processes collected capacitance data, accurately identifying bubbles and ensuring sampling accuracy. Data preprocessing, feature extraction, and classification enable precise bubble detection. Compared to the traditional CART decision tree algorithm, this algorithm demonstrates superior bubble detection performance, indicating its significant research value and potential for liquid-level detection in fully automated immunoassay analyzers.