The rapid development of Artificial Intelligence (AI) technology has profoundly affected the digitization process in the field of literature, and the application of AI technology in the ethical criticism of digital literary narratives has become more and more widespread. In this paper, combining RoBERTa pre-training model, BiLSTM, and attention mechanism, we constructed a sentiment analysis model based on RoBERTa-BiLSTM-Attention, and analyzed the sentiment trend of the novel text with the object of Chinese New Century Literature “The Riverbank” as a basis for the AI to generate literary narrative ethical criticism. The experimental results show that this paper’s model with the multi-head attention mechanism layer improves 3.22% and 1.65% in the two evaluation indexes of accuracy and F1, respectively, compared with the RoBERTa-BiLSTM model without the addition of the multi-head attention mechanism layer, which proves the effectiveness of this paper’s model in introducing the attention mechanism. Meanwhile, comparing with other models, the accuracy and F1 value of this paper’s model are optimal, reaching 88.35% and 86.52%, respectively, which indicates that this paper’s model is suitable for the task of recognizing the emotions of literary texts.