Elections for president and vice president will take place in 2024. Heading into the election, promoted candidates were vying for public sympathy. People often discussed as presidential candidates are Anies Baswedan, Ganjar Pranowo, and Prabowo Subianto. Therefore, we need a way to predict potential candidates and voter demographics from public opinion on Twitter using sentiment analysis. One of his methods commonly used to classify sentiment analysis is Naive Bayes. This study used the naive Bayes classifier and the TF-IDF extraction function to add weights to the text. Use the scikit-learn Python library to help determine the polarity of negative and positive sentiment classes in your dataset. The datasets used were Twitter datasets acquired from October to December 2022, for a total of 15,000 datasets. The best test scenario obtained by splitting the test and training data is 70% test data and 30% training data, with the highest accuracy generated from the 95% Ganjar dataset. Using the Anies, Ganjar, and Prabowo test data, the positive mood scores for each candidate were 833, 77, and 524, respectively, while the negative mood scores were 637, 1423, and 976, respectively. The test was performed using a confusion matrix and k-fold cross-validation, and the best results were obtained on the Ganjar data set. That is a confusion matrix of 94.93% and a k-fold cross-validation of 94.46%. The lowest f1-score for the positive class is 67% for the Anies dataset and 27% for the negative class for the Ganjar dataset.