This is a constantly recurring thought in the 'Essay on Man.' Cf.
' Go, teach eternal wisdom how to rule —
Then drop into thyself, and be a fool!' Part ii. 1. 29.
But the actual quotation, though inaccurate, as Johnson's quotations usually are, is doubtless taken from the lines —
' See! and confess, one comfort still must rise;
'Tis this, Tho' man's a fool, yet God is wise.' Part ii. 1. 293.