Resumen: Quantum computing is one of the most promising technologies for the upcoming decades, with applications ranging from pharmacy to finance. However, its physical realization is an enormous challenge. The microscopic systems used to process information in these devices are subject to decoherence due to the interaction with their environment, spoiling the results of any intended calculation. Our objective in this thesis work has been to apply optimal control theory to a system described by Lindblad's equation, a strategy that has been proposed to deal with errors. We will address the particular case of spin qubits on molecular nanomagnets. First, we have built a model to describe their dynamics in the presence of noise. Then, making use of it, we have designed and programmed an algorithm capable of simulating these systems and finding the optimal way to implement operations on them, minimizing errors. The results are promising, since we have obtained fidelities over 90%.