Is it legal (in certain conditions) to have your primary airport of intended landing, also listed as the alternate?
You would never list your destination as an alternate (that wouldn't logically make sense), but there are situations where having an alternate is not required:
At least one destination alternate aerodrome must be designated and specified in the both operational and ATS flight plans if a flight under IFR is going to be made unless one of the following applies:
after taking all relevant factors into account, it is reasonably certain that VMC will prevail for the approach and landing and there is more than one independently useable runway available which can be expected to be useable at the ETA and at least one of those runways has an instrument approach procedure
the aerodrome is isolated, in which case a destination alternate is not required and instead additional fuel must be carried. a Point of No Return (PNR) must be determined and this must not be passed unless an assessment of the prevailing weather, traffic and other operational conditions indicates that a safe landing can be achieved at the ETA.
Source: https://www.skybrary.aero/index.php/Alternate_Aerodrome (ICAO Annex 6 Chapter 4)
The definition of "alternate airport" in 14 CFR § 1.1 is:
Alternate airport means an airport at which an aircraft may land if a landing at the intended airport becomes inadvisable.
If my intended airport is Sparta, then clearly Sparta itself is not "an airport at which an aircraft may land if a landing at [Sparta] becomes inadvisable." So the intended airport cannot be an alternate airport.
Now, there doesn't seem to be any regulation which explicitly says that you're not permitted to list your destination as your alternate. But 14 CFR § 91.169 says that a flight plan is required to include "an alternate airport," and a common-sense reading of this regulation says that the airport you list must actually be an alternate airport. If you say that your destination is Sparta and your alternate is also Sparta, then you have not satisfied the requirement to specify an alternate airport.