Heh heh, it's little questions like this that make reference librarians pause... Why? Because finding a seemingly simple statistic can often be rather tricky. Things aren't always counted the way people think they are, or the counting only started recently, or ended years ago...
One good source for this question would be the New York State Statistical Yearbook. (Some recent years of this are online.) We have it here in print, from 1968 to date. The current copy is at the reference desk, and the rest are in our print NY documents collection on the ground floor, NYS Docs 012.1-3 NEWYS 84-8.
Oh, how many? There are 36,000 farms in NY, or were in 2004, the last year reported, and in 1964 (the year cited in the 1968 edition) there were 56,510.
Government documents questions? Ask at our reference desk, or email our government documents librarian, Lori Lampert, directly at firstname.lastname@example.org.