Once you have the attachment ID you can add alt text by setting the _wp_attachment_image_alt
post meta for the attachment:
update_post_meta( $attachment_id, '_wp_attachment_image_alt', 'Alt text here' );
To get the attachment ID from media_sideload_image()
you can set the 4th argument to 'id'
:
$attachment_id = media_sideload_image( $file, $post_id, $desc, 'id' );
if ( ! is_wp_error( $attachment_id ) ) {
update_post_meta( $attachment_id, '_wp_attachment_image_alt', 'Alt text here' );
}