Public acceptance and support for renewable energy are important determinants of the low-carbon energy transition. This paper examines public sentiment toward solar energy in the United States using data from Twitter, a micro-blogging platform on which people post messages, known as tweets. We filtered tweets specific to solar energy and performed a classification task using Robustly optimized Bidirectional Encoder Representations from Transformers (RoBERTa). Our RoBERTa-based sentiment classification model, fine-tuned with 6300 manually annotated tweets specific to solar energy, attains 80.2% accuracy for ternary (positive, neutral, or negative) classification. Analyzing 266,686 tweets during the period of January to December 2020, we find public sentiment varies widely across states (Coefficient of Variation =164.66%). Within the study period, the Northeast U.S. region shows more positive sentiment toward solar energy than did the South U.S. region. Public opinion on solar energy is more positive in states with a larger share of Democratic voters in the 2020 presidential election. Public sentiment toward solar energy is more positive in states with consumer-friendly net metering policies and a more mature solar market. States that wish to gain public support for solar energy might want to consider implementing consumer-friendly net metering policies and support the growth of solar businesses.