A 14-year-old boy was arrested and charged with setting fire to a vacant Lower East Side synagogue that burned to the ground on Sunday, police said.

The boy, who lives a half mile from the Beth Hamedrash Hagodol synagogue, was taken into custody about 8 p.m. Tuesday, police said.

Investigators had been reviewing footage of three kids running near the location of the synagogue around the time of the fire. They were able to locate the individuals seen in the video, which led to the boy’s arrest, a law enforcement source said. He was charged as a minor for arson, cops said.

The investigation is ongoing, according to police.

The synagogue, built in 1850, was set on fire about 7 p.m. Sunday. Flames ripped through the landmarked building for nearly two hours before the blaze was put under control.

Rabbi Mendel Greenbaum, who led the synagogue for about 30 years, called the loss of the synagogue “a personal family tragedy.”

“Everybody’s in shock,” said Greenbaum, whose father-in-law was rabbi for many decades before him.

The synagogue had been closed since 2007 because membership dwindled, the rabbi said. Before that it was home to the Beth Hamedrash Hagodol congregation, which is the oldest Orthodox congregation of Russian Jews in the United States, according to the Lower East Side Jewish Conservancy.

The congregation began using the synagogue in 1885.

With Alison Fox