Probably the closest Machiavelli gets to expressing this view is in Chapter XVIII of "The Prince":
[M]en judge generally more by the eye than by the hand, because it belongs to everybody to see you, to few to come in touch with you. Every one sees what you appear to be, few really know what you are, and those few dare not oppose themselves to the opinion of the many, who have the majesty of the state to defend them; and in the actions of all men, and especially of princes, which it is not prudent to challenge, one judges by the result.
For that reason, let a prince have the credit of conquering and holding his state, the means will always be considered honest, and he will be praised by everybody because the vulgar are always taken by what a thing seems to be and by what comes of it; and in the world there are only the vulgar, for the few find a place there only when the many have no ground to rest on.
Needless to say, this is considerably more nuanced than the stick-figure consequentialism commonly attributed to the Florentine political theorist.
What's more, it's not clear that Machiavelli is being completely serious here. Philosopher and writer Jean-Jacques Rousseau long maintained that "The Prince" was a work of satire that sought to expose the cynicism of one-man rule. This doesn't sound that far-fetched when you consider that Machiavelli was arrested and tortured by agents of the Medici family, whose members he dedicated "The Prince" to. And there's no denying that Machiavelli had an impish streak; during his later years, he wrote several popular – and politically stinging – satirical comedies for the stage.