There is no bad time to visit Peru.
Here are some facts:
Most rainfall (rainy season) is seen in January, February, March and December.
Cusco has dry periods in May, June, July, August and September, but it is cold at night.
On average, the warmest month is September.
The coolest month is January, but rain is inevitable. January is the wettest month.
June is the driest month.
The months September, October, November and December have a nice average temperature and are my personal favorites.