(This is a fixed version of another answer, with inaccuracies corrected. Fixes are sourced and in italics. For some reason fixing the original answer was not accepted.)
As far as I can tell, it is not a crime to run for any elected office in the US as an unqualified candidate. That said, there are a huge number of roadblocks that prevent unqualified candidates from being elected and then taking office.
Roadblock #1: Getting on the ballot.
It is up to election officials (typically headed by a state's Secretary of State) to keep unqualified candidates off the ballot. If a candidate is not qualified (and that includes running as a third term president), said candidate should not be appearing on the ballot. Some states even require potential write-in candidates to be qualified.
Roadblock #2: Ballot counters.
Assuming the election officials did their job, the official ballot counters don't need to worry about excluding votes for unqualified candidates. In states that don't certify who is/is not qualified to run for an office as a write-in candidate, they might have to toss write-in votes for, example, Mickey Mouse (a favorite write-in, where allowed).
Roadblock #3: The Electoral College.
The Electors swear an oath to the US Constitution, which includes the 22nd Amendment. In some states it has even been made a crime to be a Faithless Elector. That sets up a quandary if the winning candidate in some state passes the first two roadblocks but is indeed unqualified. Said electors are caught between a rock and a hard place. They might be violating state law by being faithless and voting against the elected unqualified candidate, but they might be violating state law by violating the US Constitution.
Non-roadblock: The US Congress.
The US Congress meets in a joint session on January 6 to certify the presidential election results. However, 3 USC 15 (d)(2)(B)(ii) clearly specifies what grounds are valid in order to reject electoral votes, and the qualification of a presidential candidate is not one of them.
Roadblock #4: The courts.
Suppose that somehow an unqualified presidential candidate did make it past all of the previously mentioned roadblocks and has been elected. Everyone who opposes this election will likely qualify as an aggrieved party in order to contest any of the "president"'s actions in court. In the US, all courts have the power and duty to apply the constitution.
Possible anti-roadblock: Side-skirt the 22nd Amendment.
This would try enacting Woodrow Wilson's bizarre scheme in 1916 should Wilson have not been elected to a second term. (He was narrowly reelected in the Electoral College so the scheme was never put into play.) The issue at hand back then was the very long lame duck session between the November election and the March 4 presidential transition. In case Wilson's opponent had won the election, the plan was to appoint Charles Evans Hughes (Wilson's opponent) as US Secretary of State (second in line back then) and then Wilson and Marshall resigning for Hughes to become acting president until becoming the actual president on March 4th. The modern equivalent would be for Mike Johnson (or whoever is speaker in 2028) to resign as Speaker of the House, the House electing Donald Trump as Speaker, and then Trump and Vance resigning.
The validity of such a scheme is not certain, because holding an office that is part of the presidential line of succession does not override the constitutional requirements for being president: age, US citizenship at birth, not having done more than 1 and a half terms already, and so on. In fact, during the Trump and Obama administrations, there have been several examples : for instance, Elaine Chao, Secretary of Transportations under Trump (also known for being Mitch McConnell's wife) was born in Taiwan and excluded from the line of succession during her tenure. In the scheme described above, if Trump as Speaker of the House does not qualify to be acting president, as specified in 3 USC 19 (b), that duty would fall upon the next person in line, presumably the president pro tempore of the Senate.
However, it is not clear whether having completed 2 terms (or one and one half...) constitutes a bar for being president or acting president, because the wording of the 22nd Amendment specifically bars someone from being "elected" president more than twice. As opposed to the other qualifications of ArtII.S1.C5.1 which mention "be eligible to the Office of President", and the wording of the 14th amendment which mentions "hold any office [] under the United States". Depending on the judge and the court, it may or may not hold.
Anti-roadblock #2: Repeal the 22nd Amendment.
If this gets done in time, easy-peasy; there's no longer a bar on becoming a third term President. This has come up before, almost every time the US has had a two term President since FDR. However, none of those repeal proposals had any legs.
Anti-roadblock #3: Repeal and replace the entire Constitution.
This, too, is a highly unlikely proposition. However, it has happened in other countries, so while highly unlikely, it is possible.