The only sure way for someone to obtain ownership of a stray or lost dog is through a shelter.  Animal shelters in New York state are required by law to check stray or abandoned animals for microchips within 24 hours of their delivery to the shelter; if an owner cannot be identified in this way, and if nobody claims the dog for 5 days, the shelter is free to adopt out the animal.  You can adopt the dog at that time, and the shelter will provide you with all the paperwork you need to prove ownership.  See N.Y. AGRIC. & MKTS. LAW §§ 331 & 332.

If you simply keep the dog without taking it to a shelter, you have no way to prove ownership and your ownership can be challenged.