A Brentwood teenager was arrested Friday night for shooting a man hours earlier outside the Brentwood Public Library in what may be a gang-related crime, police said.

Carlos Argueta, 16, fired a bullet into a man, 22, after a dispute between the two escalated just after 2 p.m. at the corner of Fourth Street and Third Avenue, said Det. Sgt. Anthony Lavista of the Third Precinct.

Young onlookers scattered after the shooting at the corner, which borders the library’s parking lot, while Argueta ran off, police said.

VideoPolice: Man shot near Brentwood High SchoolDataGun crime numbersPhotosRecent LI mug shots

The victim’s injury was not life-threatening, and he was taken to Southside Hospital in Bay Shore, police said.

He was shot in the abdomen, police said in a news release.

Argueta, of 96 Adams Ave., was charged with second-degree assault, criminal possession of a weapon and tampering with physical evidence.

advertisement | advertise on newsday

The gun was recovered, Lavista said, and the investigation continues on the source of the dispute and whether it was gang-related.

Witnesses’ information helped detectives track down Argueta, Lavista said.

“We found him out on the street,” he said. “We had a good description and knowledge of who it might be, and we had detectives out on the street who were able to track him down in the Brentwood area.”

Other details were not released, including how Argueta tampered with evidence and where the gun was found.