how can i show only the parents in owl-carousel?

According to the documentation, you would have to use post_parent => 0

So your code would look like this:

<div class="owl-carousel owl-theme">
    <?php
    $c  = 0;
    $q2 = new WP_Query( array( 
          'post_type'   => array( 'post', 'book' ),
          'post_status' => 'publish',
          'post_parent' => 0, //add this here
          'orderby'     => 'modified',
          'order'       => 'desc'
    ) );
    
    while ( $q2->have_posts() ) : $q2->the_post();
        $c ++;
        ?>
        <li class="item">
            <a href="<?php the_permalink(); ?>">
                <?php the_post_thumbnail(); ?>
                <div class="metaitem">
                    <ul>
                        <li><?php the_title(); ?></li>
                        <li><?php the_excerpt(); ?></li>
                    </ul>
                </div>
            </a>
        </li>
        <?php
    endwhile;
    wp_reset_postdata();
    ?>
</div>