The widow of a fallen NYPD cop is seeking Social Security benefits for their toddler daughter — who was conceived three years after his murder.

Pai Xia Chen, whose husband, Detective Wenjian Liu, was shot alongside his cop partner Rafael Ramos in a Brooklyn ambush in 2014, gave birth to a daughter in 2017 using her dead husband’s preserved sperm.

But the federal government won’t recognize the child when its comes to the financial assistance, deferring to New York state’s inheritance laws, which make no allowance for kids conceived this way.

State Sen. Andrew Gounardes (D-Brooklyn) is now taking up Chen’s cause and introducing a bill that would ensure she gets the payments.

“Families like a Detective Liu’s who suffer a terrible unexpected loss should not be prevented from receiving what is theirs because of antiquated laws,’’ Gounardes told The Post on Tuesday.

“Assisted reproductive technology after one partner dies is now a true option for families that deal with tragedy, including first responders in the line of duty.’’

Chen added, “If this bill passes, my daughter would have a better life.

“I am incredibly hopeful that my husband Wenjian Liu’s very own miracle baby, Angelina Liu, will be treated like all other line-of-duty children.’’

Liu, 32, and Ramos, 40, were fatally shot in December 2014 as they sat in a marked patrol car. Their killer, Ismaaiyl Brinsley, had reportedly been simmering over the police-involved deaths of Michael Brown in Missouri and Eric Garner on Staten Island, writing on Instagram just before his heinous crime: “I’m putting wings on pigs today.’’

Liu and Chen had been married just three months before his death.

She had his sperm preserved the night of the shooting and later became pregnant through in-vitro fertilization and gave birth to Angelina in July 2017.

But according to Gounardes’ bill, “When Ms. Chen went to apply for federal Social Security benefits … she was denied under a federal law which dictates that the child must be before or conceived prior to the genetic parent’s death in order to automatically receive benefits.

“If this is not the case, the child is then considered non-martial and the Social Security Administration turns to applicable state law to determine the biological status of the child — and this is where (state law) comes into play.”

Under New York’s current estate law, the couple’s daughter is not considered his “biological” child because Liu didn’t provide written consent for the use of his sperm in the presence of two witnesses and such a statement was not filed with the Surrogate Court within seven months of his death.

Liu met only one requirement: His daughter was born within 33 months of his death.

Gounardes told The Post, “With a death so sudden and unexpected, there was no opportunity for the Liu family to meet any of the other requirements in the statute.”

His proposal would remedy the situation by providing a presumption that a posthumously conceived child is a biological product of the dead parent, as long as the second parent is the surviving spouse of the decedent.

“Allowing Detective Liu’s widow and child to receive Social Security benefits is the very least we can do to honor his service and the tremendous sacrifice he made on the night of Dec. 20, 2014,” Gounardes said.

Chen said Angelina “truly is a miracle, a gift from above.

“I am humbled and grateful to the Detectives Endowment Association, especially Paul DiGiacomo, who worked tirelessly to help me and all other line of duty families, attorney Sean Riordan and Sen. Gounardes — who have all worked so hard to make this legislation a reality,” she said.

“We need to pass this legislation not just for me but for all line of duty widows who wish to raise their husbands’ children and have the family their loved ones always wanted.”