Yes it's safe to turn off your main water supply to your house while on vacation.
In fact it's best to turn off your main water supply while on vacation to prevent any potential water leaks due to burst pipes or other burst plumbing.
I always turn off my main water supply before going on vacation for a month or longer.
What I do is call the city or town and schedule a time for them to come turn the water off for me.
There is a small disconnect and reconnect fee but it's well worth the cost because I once had to come back after a month to a major disaster of a water leak that damaged my entire living room and kitchen due to a severe water leak from a burst pipe in my kitchen.
That required thousands of dollars in repairs to both the plumbing as well as the flooring, drywall etc.
Luckily the meter reader reading the water meters realized the meter was spinning fast and nobody was home so he shut it off for me.
Then the city contacted me and told me about it.
So I had to come home from vacation sooner than I had expected.