The NY State Uniform Fire Prevention and Building Code requires a minimum 3-foot clearance between the exterior walls of adjacent structures.
Local codes may be stricter; e.g., NYC requires 4 feet in most residential areas. Always check with your local building department before construction.