Cyberbullying is a significant social problem, especially for Generation Z,who actively use social media such as Twitter, Instagram and TikTok. It has a very negative impact on the victim's mental health, such as a sense of isolation, loss of confidence, and insecurity. This study aims to compare the performance of two machine learning algorithms, namely Naive Bayes and Random Forest, in sentiment analysis related to cyberbullying in Generation Z through the Twitter platform. The research method involved collecting and preprocessing data from 5505 tweets, which were then divided into training data (80%) and test data (20%). The research also applied Synthetic Minority Oversampling Technique (SMOTE) to overcome data imbalance. Preliminary results show that before the application of SMOTE, Naïve Bayes had an accuracy of 92% and Random Forest reached 94%. After the application of SMOTE, the performance of both algorithms changed. Naive Bayes accuracy decreased to 89%, with precision increasing from 92% to 99% for negative sentiments, but recall dropped from 100% to 79%, resulting in an F1-Score of 88%. In contrast, Random Forest showed significant improvement, with accuracy reaching 100%, precision and recall for negative sentiment remaining 100%, and F1-Score increasing from 97% to 100%. This study concludes that Random Forest, with the application of SMOTE, provides more stable and effective performance than Naive Bayes in cyberbullying sentiment analysis. These results are expected to support the development of text analysis technology and efforts to prevent cyberbullying in Generation Z.