Use "has" because "Mary" is a third person singular subject: Mary has many cows on her farm.
Mary is the subject of the sentence, and has is the verb. The verb must agree with its subject. In the simple present has should be used with a third person singular subject (Mary, Jim, he, she, it, the book, a cat, etc.), and have should be used in all other places. Below is a chart showing when to use has and when to use have.
| singular | plural | |
| first person: | I have | we have |
| second person: | you have | you (all) have |
| third person: | he/she/it has | they have |
I hope this helps.
Read another article about has and have here.
To learn when to use don't and when to use doesn't, click here.