There is a good deal of truth to it, in my opinion, but it's certainly not always true; dissent, it seems obvious to me, may be either patriotic or not, depending on circumstances and, most importantly, motivation.
The quote is generally attributed to Thomas Jefferson (as are a great many things he didn't say). Monticello.org offers a list of spurious quotes, as well as info on their true origin. This one seems to be no older than 1961, where it appeared in this form:
"If what your country is doing seems to you practically and morally wrong, is dissent the highest form of patriotism?"As Monticello notes, it came to wide attention during the Vietnam era. I remember hearing it used often (and no doubt used it myself) at that time.
In any case, that is all irrelevant, since dissent is no longer patriotic – it's racist.