See the note below from US Consulate website. Though getting visa is possible but it is not advisable to apply as a third-country applicant as the time taken to get an appointment may exceed your length of stay in Canada. One needs to pay the fees in advance without knowing the schedule. I strongly suggest applying in your home country once you have a Canadian TRV. Us Consulate in Toronto gets really busy from Feb till August. You may try consulates in smaller cities if you must.
Visa Appointment Availability
22 December, 2021
Please note that due to an increasing backlog of visa appointment requests, you may experience a significant delay between paying your visa fee and scheduling an interview appointment. By paying the visa fee, you acknowledge that it may take several months to schedule an interview appointment.