That same emblem, but without the crossed rifles, has been posted and discussed here in the What-Is-It forum sometime in the past year or two. As Taz420 correctly suggests, the vertical US flag at right with sunrise-over-mountains at left is seen on New York State Militia buttons. Nobody here ever figured out the meaning of the central emblem's third part, which I can only describe as being similar to the "Star Of Bethlehem" four-pointed starburst on a horizontally-lined background.
The size of your insignia indicates it is a hat-badge... and the "screw-pin" attachment on its back indicates that it dates from sometime between the 1890s through the middle of World War Two.
By the beginning of the 20th Century, the New York State Militia had mostly (or entirely) become units of the US National Guard. The crossed rifles on your hat-badge suggest an Infantry unit of the NY National Guard.