Last month, City Council members grilled Mastro at his nomination hearing.
Dozens of Democrats said they would block his appointment because of his record of backing conservative causes.
There were suspicions Adams chose him since part of his job would be to defend the mayor in a civil sexual assault lawsuit.
In his letter, Mastro wrote, "I had a hearing, but most Council members weren't listening. They'd already made up their minds for reasons unrelated to the merits."
Adams responded by calling it unfortunate that politics will deprive New Yorkers of, "one of the most qualified candidates for this office our city has ever seen."
Adams added, "I want to thank Randy for his willingness to serve the city he loves and his time and effort over the last few months meeting with members of the City Council to discuss his transformative vision for our esteemed Law Department."
----------
* Get Eyewitness News Delivered
* More New York City news
* Send us a news tip
* Download the abc7NY app for breaking news alerts
* Follow us on YouTube