
Lets get into the minds of the Founding Fathers trying to get a nation up and running. They were familiar with the Qur'an, I am sure. They all understood the terms jihad (a holy war, a religious duty, waged by Muslims against infidels i.e. Christians) from the Qur'an. They knew their customer's beliefs.
Surah 5:51 "O you who believe! Take not the Jews and the Christians for your friends and protectors: they are but friends and protectors to each other. And he among you that turns to them for friendship is of them."
The 1797 treaty with Tripoli was one of the many treaties in which each country officially recognized the religion of the other in an attempt to prevent further escalation of a "Holy War" between Christians and Muslims.(2)
Reading a book called "Original Intent: Courts, the Constitution, & Religion" by David Barton will shed some light called truth on the situation. Although I haven't read it yet, he is an author who is familiar to us Home Schoolers. Barton knows his history.

So, was Jefferson wrong in trying to make a deal with the devil? In reflection. if he saw the hostility and persecutions towards Christians around the world these days and what happened on 9/11, would he have still made the Treaty of Tripoli? Probably so, as a non-Christian (without the guiding logic of the Holy Spirit).
Incidentally, we owe the strength of our, then fledgling, U.S. Navy to Pasha of Tripoli. President Jefferson was in the process of disbanding the Navy when, in bad timing, Pasha of Tripoli declared war on the US. Glory goes to our Lord Jesus Christ.
So did the Treaty of Tripoli repudiate Christianity? Nope. In fact, while discussing the Barbary conflict with Jefferson, Adams declared:
The policy of Christendom has made cowards of all their sailors before the standard of Mahomet. It would be heroical and glorious in us to restore courage to ours.(3)
Furthermore, it was Adams who declared:
The general principles on which the fathers achieved independence were. . . . the general principles of Christianity. . . . I will avow that I then believed, and now believe, that those general principles of Christianity are as eternal and immutable as the existence and attributes of God; and that those principles of liberty are as unalterable as human nature.(4)
Adams' own words confirm that he rejected any notion that America was less than a Christian nation.(5)
Jefferson on the other hand....
---
Endnotes:
(1) Glen Tucker, Dawn Like Thunder: The Barbary Wars and the Birth of the U. S. Navy (Indianapolis: Bobbs-Merrill Company, 1963), p. 127.
(2) Gardner W. Allen, Our Navy and the Barbary Corsairs (Boston: Houghton, Mifflin and Company, 1905), pp. 56.
(3) John Adams, Works, Vol. VIII, p. 407, to Thomas Jefferson on July 3, 1786.
(4) John Adams, Works, Vol. X, pp. 45-46, to Thomas Jefferson on June 28, 1813.
(5) David Barton
UPDATE: Well I have been set straight and missed quite a bit about our history. A man named William R. Bowen wrote a brilliant article on this subject called Tempest in a Treaty: Does the Treaty of Tripoli Support a Secular America?
I missed a great point that:
Article XI refers to the “government” of the United States, not the “nation.”and the viewpoint of religion back then meant something entirely different as so eloquently pointed out by George Mason.
Thanks for setting the record strait Mr. Bowen.