The first explosion, on September 17, occurred along the route of a charity 5K race in Seaside Park, New Jersey.
"You have no remorse for what you did", she said.
One life term was mandatory but the judge exercised his discretion by imposing life sentences for counts that Rahimi's defense lawyer said deserved only a 15-year sentence.
He went on to place a homemade bomb - packed into a pressure cooker and wired to a flip-phone detonator - on a stretch of the Chelsea neighborhood's West 23rd Street, busy with pedestrians on a warm Saturday night.
Ahmad Rahimi, an Afghan-born US citizen convicted of planting bombs in NY and New Jersey.
While speaking in court Rahimi placed blame on the Federal Bureau of Investigation for not acting on his father's warning.
Rahimi, a naturalized USA citizen who was born in Afghanistan, was arrested after a gunfight with New Jersey police, who found he was carrying a journal with praise for Islamic terrorists and promises of violence. "But through life experience, I have learned to understand why there's such frustration between the Muslim community overseas and the American people".
Mohammad Rahimi, told NBC New York on Monday that he told the Federal Bureau of Investigation in 2014 that he was anxious his son might have been radicalized.
One of the inmates Rahimi tried to radicalize was already in prison in prison facing charges of attempting to recruit for ISIS. The day after the Chelsea explosion, Rahimi returned to New Jersey and left a backpack containing six pipe bombs in an Elizabeth, N.J., train station.
"The nature of the crime was heinous, wanton and life-threatening.it's inexplicable that anyone would do that intentionally", U.S. District Judge Richard Berman said, according to CNN.
Rahimi was also ordered to pay $562,803 in restitution to the victims of his crimes, the statement added. "He failed", said New York Police Department Commissioner James O'Neill.
Late past year, Rahimi began trying to radicalize prisoners at the Metropolitan Correctional Center, prosecutors say.