We successfully synthesized a stable anionic microporous metal-organic framework (MOF) HDU-1 ([Me2NH2]2In2[(TATAB)4(DMF)4](DMF)4(H2O)4) and constructed a fluorescent probe Tb@HDU-1 by an exchange strategy. Because of its suspension distinct fluorescent response of Tb(III) characteristic transition and ligand emission, the Tb@HDU-1 can be used as fluorescent probe for sensing towards Fe3+ and Cu2+ ions. It is surprising that Tb@HDU-1 is used as a ratiometric fluorescent probe for Cu2+ ions while only single peak detection for Fe3+ ions, which describes a particular rare example of a sensor based on Ln-MOFs to distinguish quenching Fe3+ and Cu2+ ions. Hence we designed a molecular logic gate device for making the distinction of Fe3+ and Cu2+ ions more clearly and appropriately. In addition, the different quenching effect between Fe3+ and Cu2+ ions may be ascribed to the differences of competitive absorption and interaction between frameworks and metal ions.