In this study, we investigated the correlation between serum albumin levels and cognitive function, and examined the impact of including serum albumin values in the input layer on the prediction accuracy when forecasting cognitive function using deep learning and other machine learning models. We analyzed the electronic health record data from Osaka Medical and Pharmaceutical University Hospital between 2014 and 2021. The study included patients who underwent cognitive function tests during this period; however, patients from whom blood test data was not obtained up to 30 days before the cognitive function tests and those with values due to measurement error in blood test results were excluded. The Mini-Mental State Examination (MMSE) was used as the cognitive function test, and albumin levels were examined as the explanatory variable. Furthermore, we estimated MMSE scores from blood test data using deep learning models (DLM), linear regression models, support vector machines (SVM), decision trees, random forests, extreme gradient boosting (XGBoost), and light gradient boosting machines (LightGBM). Out of 5,017 patients who underwent cognitive function tests, 3,663 patients from whom blood test data had not been obtained recently and two patients with values due to measurement error were excluded. The final study population included 1,352 patients, with 114 patients (8.4%) aged below 65 and 1,238 patients (91.6%) aged 65 and above. In patients aged 65 and above, the age and male sex showed significant associations with MMSE scores of less than 24, while albumin and potassium levels showed negative associations with MMSE scores of less than 24. Comparing MMSE estimation performance, in those aged below 65, the mean squared error (MSE) of DLM was improved with the inclusion of albumin. Similarly, the MSE improved when using SVM, random forest and XGBoost. In those aged 65 and above, the MSE improved in all models. Our study results indicated a positive correlation between serum albumin levels and cognitive function, suggesting a positive correlation between nutritional status and cognitive function in the elderly. Serum albumin levels were shown to be an important explanatory variable in the estimation of cognitive function for individuals aged 65 and above.