What is clear is that judges usually judge cases based on their knowledge, experience, personality, and sentiment. Due to high pressures and stress, it may be difficult for them to carefully examine documents and evidence, which leads to more subjective judgments. Legal judgment prediction with artificial intelligence algorithms can benefit judicial bodies, legal experts, and litigants as well as judges. In this research, we are looking at predicting legal sentences in drug cases involving the purchase, possession, concealment, or transportation of illicit drugs, using machine learning methods, and the effect of sentiment and emotions in case texts on predicting the severity of whipping, fines, and imprisonment. So, the text documents of 6000 Persian drug-related cases were pre-processed and then the translation of the NRC Glossary of Emotions and sentiment was used to give each item a score for positive or negative sentiment and a score for emotion. Then machine learning methods were used for modeling. BERT, TFIDF+Adaboost, and Skipgram+LSTM+CNN methods had the highest accuracy, respectively. Also, evaluation criteria were analyzed in situations where sentiment scores, emotional scores, or both were used in the prediction process along with judicial texts. Finally, it was found that the use of sentiment and emotion scores improves the accuracy of legal judgment predictions for all three types of sentences and that sentiments have a greater impact on the accuracy of legal judgment predictions than emotions