Objective To analyze the risk factors for epileptic seizure in patients with encephalitis, and to establish a risk prediction model. Methods A total of 414 patients with encephalitis were selected as the research subjects, therein 328 patients were regarded as modeling group, and the remaining 86 patients as the validation group. According to the presence of epileptic seizure, patients in the modeling group were divided into seizure group (n=90) or non⁃seizure group (n=238). Their general data, laboratory examination indices, electroencephalogram results, and intracranial pressure were compared between the two groups. The Logistic regression model was used to analyze the risk factors for affecting epileptic seizure in patients with encephalitis. Based on the risk factors, a risk prediction model for epileptic seizure in patients with encephalitis was established and visualized by employing a nomogram. The predictive effect of the model was validated by using the receiver operating characteristic (ROC) curve and Hosmer⁃Lemeshow test. In the validation group, the ROC curve was used for external validation on the risk prediction model. Results In the modeling group, there were statistically significant differences in heart rate, systolic blood pressure, peripheral white blood cell counts, and electroencephalogram spike wave enhancement between the seizure group and the non⁃seizure group (P<0.05). The results of multiple Logistic regression analysis revealed that elevated heart rate and systolic blood pressure, increased peripheral white blood cell counts, and enhanced electroencephalogram spike wave were the risk factors for epileptic seizure in patients with encephalitis (P<0.05). Area under the curve of the risk prediction model established based on the aforementioned risk factors was 0.820, and the results of goodness of fit interpreted that the model had relatively high accuracy (χ2=8.725, P=0.366). In the validation group, area under the curve of the model was 0.828. Conclusion Patients with encephalitis have a higher risk of epileptic seizure when their heart rate and systolic blood pressure are elevated, peripheral white blood cell counts are increased, and electroencephalogram spike wave is enhanced. The risk prediction model established based on the aforementioned risk factors for epileptic seizure in patients with encephalitis exerts favorable clinical practicality and predictive value.