No, You cannot override this file in theme under app/design folder
For that you need to create Module or Extension under app/code folder using preference
For example
vendor/magento/module-catalog-search/Model/Adapter/Mysql/Dynamic/DataProvider.php
app/code/Vendor/Module/etc/di.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\CatalogSearch\Model\Adapter\Mysql\Dynamic\DataProvider" type="Vendor\Module\Rewrite\DataProvider"/>
</config>
Then create file app/code/Vendor/Module/Rewrite/DataProvider.php
<?php
declare(strict_types=1);
namespace Vendor\Module\Rewrite\Magento\CatalogSearch\Model\Adapter\Mysql\Dynamic;
class DataProvider extends \Magento\CatalogSearch\Model\Adapter\Mysql\Dynamic\DataProvider
{
}
if it make you confuse to do custom code then just copy DataProvider.php and paste it in Rewrite folder and then change namespace accordingly
Thanks
Happy Coding