This study examined the association between post-stroke cognitive function and sleep status at 30 days post-stroke and evaluated the role of anxiety and depression as potential mediators of that association. The participants in this study were 530 acute ischemic stroke (IS) patients. Sleep disturbance at 30 days post-stroke was assessed by the Pittsburgh Sleep Quality Index. Basic patient information, cognitive function, depression, and anxiety status were assessed before discharge from the hospital. Stratified linear regression analysis models were fit to examine the associations between post-stroke sleep quality and the influencing factors. A structural equation model was developed to evaluate the role of anxiety and depression as potential mediators of sleep quality and cognitive function. At 30 days post-stroke, 58.7% of IS patients had sleep disturbance. Women and older IS patients were more likely to suffer poorer sleep quality (p < 0.05). A stratified linear regression analysis showed that the inclusion of cognitive function variables and indicators of depression and anxiety were statistically significant in predicting improvement in the sleep disturbance of AIS patients. Cognitive function, depression, anxiety, and sleep status were selected to construct a structural equation model. The total effect of cognitive function on sleep status was -0.274, with a direct effect of -0.097 and an indirect effect (through depression) of -0.177. The total effect of anxiety on sleep status was 0.235, with a direct effect of 0.186 and an indirect effect (through depression) of 0.049. IS patients often experience poor sleep quality. Depression in IS patients mediates two pathways: the pathway through which cognitive function affects sleep quality and the pathway through which anxiety affects sleep quality.