There is a general blanket protection in Federal Law, the 1986 FOPA (Firearms Owner Protection Act) that covers you against prosecution by the state, IF you are traveling THROUGH the state, from one place your gun is legal to another where it is legal.
There are certain requirements that must be met in order for this protection to apply, state law enforcement officers cannot be relied on to know what these are, and when they are applicable. Some might, but don't count on it. And, even if you are compliant with the rules, so the Act does cover you, it will not prevent arrest or incarceration awaiting a hearing, and may not prevent charges and an actual trial.
In a nutshell, gun and ammo correctly stored for transport (in the legal sense) no stops inside the prohibitive state (allowances for refueling, comfort stops, and breakdowns) you're covered. If you have a "destination" inside the state, you're not covered.
in other words, you can drive through NY on your way to Maine, and meeting all the other requirements, you're good. But, if you make a side trip to visit Aunt Martha in New Rochelle, that is a "destination" inside NY and you are not protected by the FOPA if you do that. And when you aren't protected by FOPA, you ARE breaking NY law, so expect the maximum if you get caught.
This is NOT legal advice, I'm not a lawyer. My advice is worth what you paid for it. Get actual legal advice, from a NY lawyer about NY law. Don't assume NY police or any well intentioned internet voice can give you valid advice on NY law.
Good Luck.
(and yes, the best advice is don't take guns into NY if you don't HAVE to...
it ain't right, it ain't the way it once was, but it is the way it is today..
)