Objectives Long-term uncontrolled hypertension increases the risk of kidney decompensation. This study aimed to explore the connection between albumin-corrected anion gap (ACAG) and kidney function in hypertensive patients. Methods This study utilized data from 1988 participants diagnosed with hypertension sourced from the NHANES database. Binary logistic regression analysis and subgroup analysis were utilized to investigate the relationship between ACAG and kidney function. The study employed restricted cubic spline (RCS) to assess the non-linear associations between ACAG and eGFR, as well as ACAG and ACR. Furthermore, mediation and moderation effect analyses were carried out, with blood pressure serving as the mediator and moderator, ACAG as the independent variable, and eGFR and ACR as the dependent variables. Finally, the study developed ACAG-based models for predicting kidney function decline. Results Higher ACAG is identified as an independent risk factor for eGFR < 60 mL/minute/1.73 m2 and ACR ≥ 30 mg/g. Results from RCS indicate a non-linear relationship between ACAG and eGFR, as well as between ACAG and ACR. The mediation effect analysis revealed that DBP mediated the relationship between ACAG and eGFR. Analysis on moderation effect demonstrated that SBP played a significant role in moderating the interaction between ACAG and ACR. Moreover, the models based on ACAG showed strong performance. Conclusions The levels of ACAG are found to be independently associated with both eGFR and ACR. Additionally, ACAG shows promise as a new and dependable biomarker for predicting the decline in kidney function in hypertensive patients.