Acute infection, such as periprosthetic joint infection and superficial surgical site infection, after primary total joint arthroplasty (TJA) is a serious complication, and its risk factors remain controversial. This study aimed to identify the risk factors for acute infection after primary TJA, especially the serological indicators that reflect preoperative nutritional statuses, such as albumin level and albumin to fibrinogen ratio (AFR). We retrospectively reviewed patients who underwent elective primary hip or knee arthroplasty at our institution from 2009 to 2021. Potential risk factors of acute infection and demographic information were extracted from an electronic health record. Patients who suffered acute infection, such as PJI or SSI, after TJA were considered the study group. Non-infected patients were matched 1:2 with the study group according to sex, age, the involved joint (hip or knee), and year of surgery (control group). The variables of potential risk factors for acute postoperative infection (demographic characteristics, preoperative comorbidities and drug use, operative variables, and laboratory values) were collected and evaluated by regression analysis. Restrictive cubic spline regression analysis was also used to examine the relationship between preoperative serum albumin levels and acute postoperative infection. We matched 162 non-infected patients with 81 patients who suffered from acute postoperative infection. Among the patients who suffered from acute infection within 90 days after TJA, 18 were diagnosed with periprosthetic joint infection and 63 with surgical site infection. Low albumin levels were strongly associated with acute postoperative infection (95% confidence interval, 0.822-0.980; P = 0.015). This risk increased as preoperative albumin levels decreased, with a negative dose-response relationship (P overall = 0.002; P nonlinear = 0.089). However, there was no significant association between the AFR and acute infection after primary TJA (P = 0.100). There is currently insufficient evidence to confirm the relationship between preoperative AFR and acute infection after elective primary TJA, while a lower preoperative albumin level is an independent risk factor for acute infection with a negative dose-response relationship. This suggests that optimal nutritional management may be benefited before elective primary TJA.