It depends.
References:
IRS Q & A about education credits
Tax Benefits for Education: Information Center| IRS
Q. How do I answer the question "Were you working on an Associate, Bachelor's, or Graduate Degree?"
A. You answer no, unless you were officially enrolled as a degree candidate. Just getting dual credit is not enough.
From pub 970: "Example 3. During the 2022 fall semester, Larry was a high school student who took classes on a half-time basis at College X. Larry wasn't enrolled as part of a degree program at College X because College X only admits students to a degree program if they have a high school diploma or equivalent. Because Larry wasn't enrolled in a degree program at College X during 2022, Larry wasn't an eligible student for tax year 2022." Reference: https://www.irs.gov/publications/p970/ch02.html