A former Illinois child welfare worker who investigated allegations of abuse involving a 5-year-old boy who was later beaten to death pleaded not guilty Thursday to child endangerment and reckless conduct charges.

Carlos Acosta, 54, of Woodstock, entered the plea in a McHenry County courtroom Thursday morning, the Northwest Herald reported.

Acosta worked at the Illinois Department of Children and Family Services in the months before Andrew “AJ” Freund’s body was found in a shallow grave near his family’s Crystal Lake home in April 2019, days after his parents reported him missing.

Andrew Polovin, right, a former supervisor with the Illinois Department of Children and Family Services, walks to the podium in the courtroom of Judge Robert Wilbrandt during his arraignment hearing at the McHenry County Courthouse on Thursday, Sept. 17, 2020 in Woodstock, Ill. Polovin, one of two former Illinois child welfare workers who investigated abuse allegations involving 5-year-old Andrew "AJ" Freund whose beaten body was found in a shallow grave last year pleaded not guilty Thursday to child endangerment and reckless conduct charges. (Stacey WescottChicago Tribune via AP Pool)

Andrew Polovin, right, a former supervisor with the Illinois Department of Children and Family Services, walks to the podium in the courtroom of Judge Robert Wilbrandt during his arraignment hearing at the McHenry County Courthouse on Thursday, Sept. 17, 2020 in Woodstock, Ill. Polovin, one of two former Illinois child welfare workers who investigated abuse allegations involving 5-year-old Andrew "AJ" Freund whose beaten body was found in a shallow grave last year pleaded not guilty Thursday to child endangerment and reckless conduct charges. (Stacey WescottChicago Tribune via AP Pool)

The boy’s mother, JoAnn Cunningham, has since pleaded guilty to first-degree murder and was sentenced to 35 years in prison. His father, Andrew Freund Sr. 61, pleaded guilty Friday to aggravated battery of a child, involuntary manslaughter, and concealment of a homicide and was sentenced to 30 years in prison.

McHenry County sheriff’s deputies arrested Acosta and his former supervisor, Andrew Polovin, on Sept 10. Each man is charged with two felony counts of endangering the life of a child and one felony count of reckless conduct. Both Polovin and Acosta were released on bond. Polovin pleaded not guilty on Sept. 17.

Judge Robert Wilbrandt noted he previously was associated with a local group that later named Acosta its president. Before Wilbrandt became a judge in 2006, the law firm where he worked represented the McHenry County Latino Coalition. Acosta went on to become the president of the coalition and left the organization in 2009. Wilbrandt never personally represented Acosta, he said.

Andrew Polovin, right, a former supervisor with the Illinois Department of Children and Family Services, walks to the podium in the courtroom of Judge Robert Wilbrandt during his arraignment hearing at the McHenry County Courthouse on Thursday, Sept. 17, 2020 in Woodstock, Ill. Polovin, one of two former Illinois child welfare workers who investigated abuse allegations involving 5-year-old Andrew "AJ" Freund whose beaten body was found in a shallow grave last year pleaded not guilty Thursday to child endangerment and reckless conduct charges. (Stacey WescottChicago Tribune via AP Pool)

Andrew Polovin, right, a former supervisor with the Illinois Department of Children and Family Services, walks to the podium in the courtroom of Judge Robert Wilbrandt during his arraignment hearing at the McHenry County Courthouse on Thursday, Sept. 17, 2020 in Woodstock, Ill. Polovin, one of two former Illinois child welfare workers who investigated abuse allegations involving 5-year-old Andrew "AJ" Freund whose beaten body was found in a shallow grave last year pleaded not guilty Thursday to child endangerment and reckless conduct charges. (Stacey WescottChicago Tribune via AP Pool)

Acosta’s attorney and McHenry County Assistant State’s Attorney Randi Freese agreed in open court that Wilbrandt did not need to recuse himself.

Andrew Polovin, right, a former supervisor with the Illinois Department of Children and Family Services, stands with his attorney Matthew J. McQuaid, right, in front of Judge Robert Wilbrandt for his arraignment hearing at the McHenry County Courthouse on Thursday, Sept. 17, 2020 in Woodstock, Ill. Polovin, one of two former Illinois child welfare workers who investigated abuse allegations involving 5-year-old Andrew "AJ" Freund whose beaten body was found in a shallow grave last year pleaded not guilty Thursday to child endangerment and reckless conduct charges. (Stacey WescottChicago Tribune via AP Pool)

Andrew Polovin, right, a former supervisor with the Illinois Department of Children and Family Services, stands with his attorney Matthew J. McQuaid, right, in front of Judge Robert Wilbrandt for his arraignment hearing at the McHenry County Courthouse on Thursday, Sept. 17, 2020 in Woodstock, Ill. Polovin, one of two former Illinois child welfare workers who investigated abuse allegations involving 5-year-old Andrew "AJ" Freund whose beaten body was found in a shallow grave last year pleaded not guilty Thursday to child endangerment and reckless conduct charges. (Stacey WescottChicago Tribune via AP Pool)

This Thursday, Sept. 10, 2020 booking photo provided by the McHenry County, Ill., Sheriff's Office, shows Andrew R. Polovin, one of two child welfare workers who investigated abuse allegations involving a 5-year-old boy allegedly killed months later by his parents, has been charged with child endangerment. Polovin, 48, of Island Lake, and Carlos J. Acosta, 54, of Woodstock, were arrested Thursday on two counts each of endangering the life of a child and one count of reckless conduct.  (McHenry County Sheriff's Office via AP)

This Thursday, Sept. 10, 2020 booking photo provided by the McHenry County, Ill., Sheriff's Office, shows Andrew R. Polovin, one of two child welfare workers who investigated abuse allegations involving a 5-year-old boy allegedly killed months later by his parents, has been charged with child endangerment. Polovin, 48, of Island Lake, and Carlos J. Acosta, 54, of Woodstock, were arrested Thursday on two counts each of endangering the life of a child and one count of reckless conduct. (McHenry County Sheriff's Office via AP)