Purpose: This study aims to analyze the effectiveness of the IndoBERT model for sentiment analysis of Indonesian anguage YouTube comments related to the legal Court’s ruling on the minimum age of vice presidential candidates for 2024. While previous research applied conventional machine learning methods, this study addresses the challenge of understanding nuanced public opinion using a language-specific transformer model. Methods: A dataset of 23,796 YouTube comments was collected using the YouTube Data API in January 2025. The comments underwent extensive preprocessing including normalization, case folding, text cleansing, symbol removal, stopword elimination, and stemming. Sentiment labels (positive, negative, neutral) were assigned through a lexicon based approach. Three models IndoBERT, BERT, Support Vector Machine (SVM), and Random Forest were trained and tested using an 80% and 20% split. Model result was evaluated with accuracy, precision, recall, and F1-score metrics. Result: IndoBERT achieved the maximum result with 95% accuracy, outperforming BERT 92%, SVM 88%, and Random Forest 85%. This confirms IndoBERT’s superior ability to capture contextual nuances in Indonesian sentiment analysis compared to other models. Novelty: This research demonstrates the advantage of transformer based models, particularly IndoBERT, in analyzing complex Indonesian social media texts. The findings support the use of IndoBERT for automated sentiment monitoring to inform government and media responses. Future work could extend to broader discourse analysis across diverse public sectors.