Since it's founding has the United States' Federal government, a member State's government, or any U.S. municipality withstood an attempt or organized conspiracy to attempt a military coup?
With sincerity and without sarcasm. Does the Civil War count?
It's not certain, but there is USMC Major General Smedley Butler's allegation of the Business Plot.
Butler was one of only a few (and, so far, the last) military personnel to be awarded the Medal of Honor on two separate occasions. His career spanned the Spanish-American War through the first three decades of the 20th century. Following his retirement, he became a sort of leftist, of the belief that servicemen and veterans were being exploited, and that many of his own engagements were not for the greater good, but for the enrichment of certain business interests. After disillusionment with the Republican Party, Butler ultimately came to support the Socialist Party of America, though it is unclear if he ever officially became a member.
He wrote the famous work, War is a Racket, excerpted below.
“I spent 33 years and four months in active military service and during that period I spent most of my time as a high class muscle man for Big Business, for Wall Street and the bankers. In short, I was a racketeer, a gangster for capitalism. I helped make Mexico and especially Tampico safe for American oil interests in 1914. I helped make Haiti and Cuba a decent place for the National City Bank boys to collect revenues in. I helped in the raping of half a dozen Central American republics for the benefit of Wall Street. I helped purify Nicaragua for the International Banking House of Brown Brothers in 1902-1912. I brought light to the Dominican Republic for the American sugar interests in 1916. I helped make Honduras right for the American fruit companies in 1903. In China in 1927 I helped see to it that Standard Oil went on its way unmolested. Looking back on it, I might have given Al Capone a few hints. The best he could do was to operate his racket in three districts. I operated on three continents.” —Smedley Butler, War is a Racket [quote]
Butler's first involvement with a force seeking to pressure the U.S. government came with his support of the Bonus Army, a group of veterans marching on Washington to seek a sort of pension payment granted to WWI veterans but not meant to mature for many years. When the Depression hit, so many were out of work and in need that they demanded its immediate payment. A group of thousands of such men and their families and supporters marched on the capital and occupied it. Butler spoke in support of them, but did not support violent action. This may not be completely relevant to what comes next, but (and this is pure speculation) it may have distinguished him as a respected target who could round up and lead discontented veterans.
In 1934, Major General Smedley Butler reported to Congress that he has been approached with an offer to lead a Fascist military coup against the government of President Franklin Delano Roosevelt on behalf of major industrialists and finance capitalists. The alleged coup was dubbed "The Business Plot" and implicated some of the richest and most powerful men and corporations in America. Initially, no evidence was found despite Butler's testimony, but before it was packed up, the congressional committee investigating the allegations reported that it had found reasonable evidence that the plot had existed to some degree.
As it happened, a Fascist coup was never instigated against Roosevelt, and the United States would later go on to fight Fascism in Europe. However, in examining the context of the plot, it's important to remember that at the time, Fascism was not as derided as it is today, and the United States was not yet seen as diametrically opposed to such regimes. Roosevelt's plans for the New Deal were supported by some wealthy interests as necessary for the preservation of capitalism (against such revolts as seen in Russia or Mexico), but many more viewed them with great suspicion or distaste. We may never know just how serious the Business Plot was, or how close the United States came to a Fascist coup but for the conscience of Major General Smedley Butler. But this is the closest thing that came to mind, so I hope it is the kind of answer you were looking for.
I don't know if this would meet your criteria for a coup d'etat, but the Newburgh conspiracy is the best example that I know of. u/smileyman wrote an excellent post on the subject: