The US Constitution hardly says anything at all about how a Presidential election must be held, except that states can pretty much do whatever they like:

> Each State shall appoint, **in such Manner as the Legislature thereof may direct,** a Number of Electors, equal to the whole Number of Senators and Representatives to which the State may be entitled in the Congress: but no Senator or Representative, or Person holding an Office of Trust or Profit under the United States, shall be appointed an Elector.
>
> [...]
>
> The Congress may determine the time of choosing the electors, and the day on which they shall give their votes; which day shall be the same throughout the United States.

The [Twelfth Amendment](https://www.law.cornell.edu/constitution/amendmentxii) has more to say about what those electors actually do once they have been selected, and several amendments prohibit states from restricting "the right to vote" in various ways, but there's nothing about ballots,\* in part because the secret ballot was not introduced in the US until the late 19th century.

In the early years, voters simply declared their vote aloud for everybody to hear, and poll workers tallied it. There could be no question of whose names should appear on the ballot, for there was no ballot. After the secret ballot began to catch on, for a while pre-filled ballots were often printed by partisan newspapers, which could then be dropped directly into the ballot box by sympathetic readers. Since these ballots were not provided by the state, they were effectively unregulated, and could include whatever name the newspaper liked. Wikipedia [says](https://en.wikipedia.org/wiki/Secret_ballot#United_States) that this method of voting was only fully phased out in 1950 (when South Carolina stopped allowing it).

Of course, each state will have its own laws about whose name may or may not appear on the ballot - in practice, a nominee for one of the two major parties has automatic ballot access in all fifty states (plus DC). But a state that wishes to impose additional requirements on ballot access is entirely within its rights to do so, provided that whatever procedure it uses does not violate the [Fourteenth Amendment](https://www.law.cornell.edu/constitution/amendmentxiv) (which was a problem in [*Bush v. Gore*](https://www.oyez.org/cases/2000/00-949)). This means that the state must treat candidates fairly (equal protection) and provide some kind of due process for challenging individual determinations (most likely, either some kind of administrative hearing, or a hearing in state court).

***

\* There is a very brief mention in the Twelfth Amendment that says electors must vote "by ballot" for President and Vice President. As far as I can tell from Google Image Search, these ballots are either blank (write-in), or have the name of the candidate printed on them (the electors are pledged to vote for specific candidates in advance, so it is possible to pre-print their ballots with the correct name).