Recent experiments have measured the critical Casimir force acting on a colloid immersed in a binary liquid mixture near its continuous demixing phase transition and exposed to a chemically structured substrate. Motivated by these experiments, we study the critical behavior of a system, which belongs to the Ising universality class, for the film geometry with one planar wall chemically striped, such that there is a laterally alternating adsorption preference for the two species of the binary liquid mixture, which is implemented by surface fields. For the opposite wall we employ alternatively a homogeneous adsorption preference or homogeneous Dirichlet boundary conditions, which within a lattice model are realized by open boundary conditions. By means of mean-field theory, Monte Carlo simulations, and finite-size scaling analysis we determine the critical Casimir force acting on the two parallel walls and its corresponding universal scaling function. We show that in the limit of stripe widths small compared with the film thickness, on the striped surface the system effectively realizes Dirichlet boundary conditions, which generically do not hold for actual fluids. Moreover, the critical Casimir force is found to be attractive or repulsive, depending on the width of the stripes of the chemically patterned surface and on the boundary condition applied to the opposing surface.