Background: The emergence of the hashtag #BoikotTrans7 on social media was triggered by public reaction to the broadcast of the “Xpose Uncensored” program on Trans7, which was perceived as offensive to the dignity of Islamic boarding schools (Pesantren) and religious figures. This issue quickly developed into widespread public discourse on digital platforms, particularly in YouTube comments. Objective: This study aims to analyze public sentiment on YouTube to identify patterns of opinion and public response regarding the #BoikotTrans7 controversy. Methods: Data were collected using the YouTube Data API v3 through a data crawling process from October 15 to December 4, 2025, resulting in 10,490 comments. Sentiment analysis was conducted using the Naïve Bayes classifier with TF-IDF (Term Frequency–Inverse Document Frequency) feature extraction. To improve model performance, class imbalance was addressed using the Synthetic Minority Over-sampling Technique (SMOTE), and hyperparameter optimization was performed using GridSearchCV. Results: The Naïve Bayes model achieved an accuracy of 78.46% in classifying sentiments into positive, negative, and neutral categories. The findings indicate that positive sentiment dominated YouTube comments, largely originating from users supporting Trans7 rather than boycott supporters. This suggests a discrepancy between viral hashtag narratives and actual public opinion on YouTube. Word cloud visualization highlights dominant keywords such as “Pesantren,” “Kyai,” “Santri,” and “maaf,” indicating that religious and cultural elements strongly shape the discourse surrounding the controversy. Conclusion: The study provides insights for broadcasting evaluation and contributes to the development of sentiment analysis and text mining methodologies in social media research.