Yes, you can deduct the mortgage interest paid to the builder on the loan as long as it was secured by the property you moved into.
Per IRS
Publication 936, page 4, Home under construction. You can treat a
home under construction as a qualified home
for a period of up to 24 months, but only if it becomes your qualified home at the time it is
ready for occupancy.
The 24-month period can start any time on
or after the day construction begins.