A filtration and dirt separation device comprising: i) a main body wherein an inlet conduit, intended to receive a water flow entering the filtration and dirt separation device, and an outlet conduit, intended to receive a water flow leaving the filtration and dirt separation device, are formed; ii) a cup-shaped container that is removably restrained to said main body, said cup-shaped container for housing a filter cartridge; iii) a flow-diverting valve that is movably accommodated inside the main body in a seat that is in fluid communication with said inlet conduit, said cup-shaped container and said outlet conduit, said flow-diverting valve being a three-way valve comprising channels (151, 152) adapted to selectively set the inlet conduit in fluid communication with the cup-shaped container, or with the outlet conduit depending on its position in said seat, iv) a first one-way valve that is arranged at the end of the outlet conduit that fluidly communicates with the cup-shaped container, v) a second one-way valve that is arranged at the end of the outlet conduit that is intended to be connected to a hydraulic appliance, characterized in that the flow-diverting valve, the first one-way valve and the second one-way valve are arranged such that the following operating conditions are defined: a) a first, filtration, condition whereby the flow-diverting valve prevents fluid communication from the inlet conduit to the outlet conduit and allows fluid communication from the inlet conduit to the cup-shaped container, and whereby fluid flows from the inlet conduit through the cup-shaped container, the first one-way valve, the second one-way valve and finally through the outlet conduit; b) a second, by-pass, condition according to whereby the flow-diverting valve prevents fluid communication to the cup-shaped container and allows fluid communication from the inlet conduit to the outlet conduit, whereby fluid flows from the inlet conduit through the second one-way valve and the outlet conduit, while the first one-way valve prevents the fluid from flowing from the main body into the cup-shaped container; c) a third, closing, condition whereby the flow-diverting valve prevents fluid communication from the inlet conduit to the main body, while the second flow-diverting valve prevents fluid communication from the outlet conduit to the main body. i) a main body wherein an inlet conduit, intended to receive a water flow entering the filtration and dirt separation device, and an outlet conduit, intended to receive a water flow leaving the filtration and dirt separation device, are formed; ii) a cup-shaped container that is removably restrained to said main body, said cup-shaped container for housing a filter cartridge; iii) a flow-diverting valve that is movably accommodated inside the main body in a seat that is in fluid communication with said inlet conduit, said cup-shaped container and said outlet conduit, said flow-diverting valve being a three-way valve comprising channels (151, 152) adapted to selectively set the inlet conduit in fluid communication with the cup-shaped container, or with the outlet conduit depending on its position in said seat, iv) a first one-way valve that is arranged at the end of the outlet conduit that fluidly communicates with the cup-shaped container, v) a second one-way valve that is arranged at the end of the outlet conduit that is intended to be connected to a hydraulic appliance, a) a first, filtration, condition whereby the flow-diverting valve prevents fluid communication from the inlet conduit to the outlet conduit and allows fluid communication from the inlet conduit to the cup-shaped container, and whereby fluid flows from the inlet conduit through the cup-shaped container, the first one-way valve, the second one-way valve and finally through the outlet conduit; b) a second, by-pass, condition according to whereby the flow-diverting valve prevents fluid communication to the cup-shaped container and allows fluid communication from the inlet conduit to the outlet conduit, whereby fluid flows from the inlet conduit through the second one-way valve and the outlet conduit, while the first one-way valve prevents the fluid from flowing from the main body into the cup-shaped container; c) a third, closing, condition whereby the flow-diverting valve prevents fluid communication from the inlet conduit to the main body, while the second flow-diverting valve prevents fluid communication from the outlet conduit to the main body.