California authorities are investigating a “second suspect” linked to one of the most infamous serial killers in US history, “Night Stalker’’ Richard Ramirez, according to officials and new probe details revealed to The Post.

Ramirez — the devil worshipper whose victims included a former Brooklyn mom — was tied to the 1984 rape and murder of a 9-year-old girl before his death in prison in 2013, and cops have now ID’d a second male who they believe also was at the scene at the time, sources said.

“This case is classified as ‘open’ due to the second-suspect issue,” said San Francisco Police Department Homicide Inspector John Miller.

Semen from a second man — a convicted felon — was found on a handkerchief that included the same bodily fluid from Ramirez when it was found in the boiler room of an apartment building in San Francisco, where little Mei “Linda’’ Leung’s butchered body was discovered draped over a drain pipe on April 10, 1984, sources close to the matter said. Mei’s blood also was found on the cloth.

While authorities were able to identify Ramirez’s DNA on the handkerchief in 2009, it took them several years to finally finger the second man, a source said.

Multiple sources told The Post that authorities now know the man’s identity because — while a juvenile at the time of Mei’s murder — he went on to commit other felony crimes. That enabled California lab tech Cherisse Boland to get a “cold hit’’ on him after repeatedly running the evidence through CODIS, the FBI-maintained forensic DNA database.

“The handkerchief had stains in several places that were tested,” said former prosecutor and DNA expert Rockne Harmon, who reviewed the Leung case while doing consulting work for the San Francisco District Attorney’s Office in 2009.

“The stain that produced the hit was a mixture of three people, two different semen sources. One of the sources matched Ramirez, and the other source linked the second male to the handkerchief by the stairs,” Harmon told The Post.

“It’s significant because it connects the two sources to the body,” added Harmon, one of the prosecutors in the 1995 OJ Simpson double-murder trial.

San Francisco authorities still haven’t publicly acknowledged any details about the man, including his felony record, frustrating Harmon and other law enforcement sources.

The “co-existence’’ of the other man’s DNA on the cloth “suggests a connection between Ramirez, the second male and the victim associated with her death,’’ Harmon said, urging authorities to come forward with any new information they have.

“Only a thorough, intense investigation to ascertain the truth about the presence of his [DNA] in such a sinister context will satisfy public safety interests. Anything less will not do so.”

Mei lived with her mother, a Hong Kong immigrant, and brother, who was 8 at the time. Her mother was unable to be reached, and her brother declined comment to The Post. Her family “has been ruled out as suspects,’’ a source said.

“At this time, there is insufficient evidence to charge anyone else in connection with this crime,” Max Szabo, a spokesman for the San Francisco DA’s Office, wrote in an email to The Post.

Until Mei’s death was linked to Ramirez, his first victim was believed to have been Jennie Vincow, a mom formerly from Sheepshead Bay, Brooklyn.

Vincow moved to Los Angeles in 1981, and three years later, Ramirez climbed through her home window and slit her throat to the point where he nearly decapitated her. He then sexually assaulted her corpse.

She was part of Ramirez’s monstrous 1984-’85 rampage from Los Angeles to San Francisco that paralyzed the state.

He earned the nickname the “Night Stalker” for breaking into homes in the middle of the night while the occupants were asleep and attacking them.

The Texas-born drifter was finally apprehended in 1985 by a mob of East LA residents who recognized him from his mugshot in the media.

Ramirez was convicted in 1989 and sentenced to death for 13 murders, five attempted murders, 11 sexual assaults and 14 burglaries.

He died on California’s Death Row in 2013 from lymphoma at age 53, after his skin turned a hideous shade of green from his illness.