We study the critical Casimir force for a film geometry in the Ising universality class. We employ a homogeneous adsorption preference on one of the confining surfaces, while the opposing surface exhibits quenched random disorder, leading to a random local adsorption preference. Disorder is characterized by a parameter p, which measures, on average, the portion of the surface that prefers one component, so that p=0,1 correspond to homogeneous adsorption preference. By means of Monte Carlo simulations of an improved Hamiltonian and finite-size scaling analysis, we determine the critical Casimir force. We show that by tuning the disorder parameter p, the system exhibits a crossover between an attractive and a repulsive force. At p=1/2, disorder allows to effectively realize Dirichlet boundary conditions, which are generically not accessible in classical fluids. Our results are relevant for the experimental realizations of the critical Casimir force in binary liquid mixtures.