First of all, please note that this book is not a work of fiction. Therefore, it is not set in any time period. Instead, this book is a work that gives advice to rulers as to how they should keep power.
The book was written during the early 1500s. This was during the period that was known as the Renaissance. Machiavelli was writing the book as sort of a manual for how to govern. He wanted to think about politics in a more practical way than authors previously had. Previous thinkers had focused on issues of morality and what ought to be. Machiavelli, by contrast, focused on practical issues.
So, the book is not set in any particular time. Its advice is meant for rulers of Renaissance states in Italy. However, it can have some relevance for people in other times and places.